Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 karthickv
		
			karthickv
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi All,
Can you please share a macro which can help me to perform a reload & save the file with User Name ?
Lets say I have a Sales.qvw file, upon clicking the button, macro should run and the file should be reloaded & saved as Sales K1234.qvw. Where K1234 is the OSUser Name or QVUser Name.
Thanks,
Karthick V.
 
					
				
		
 zhadrakas
		
			zhadrakas
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		hi,
create the variable "vUser" with Definition =subfield(OSUser(),'\',2)
Then use this macro
sub Reload_Save
 set docprop = ActiveDocument.GetProperties
 Filename = docprop.FileName
 
 set v = ActiveDocument.Variables("vUser")
 Username = v.GetContent.String
 
 ActiveDocument.Reload
 ActiveDocument.SaveAs left(FileName, len(FileName)-4) & " " & Username & ".qvw"
 end Sub
 
 
 
					
				
		
 zhadrakas
		
			zhadrakas
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		hi,
create the variable "vUser" with Definition =subfield(OSUser(),'\',2)
Then use this macro
sub Reload_Save
 set docprop = ActiveDocument.GetProperties
 Filename = docprop.FileName
 
 set v = ActiveDocument.Variables("vUser")
 Username = v.GetContent.String
 
 ActiveDocument.Reload
 ActiveDocument.SaveAs left(FileName, len(FileName)-4) & " " & Username & ".qvw"
 end Sub
 
 
 tamilarasu
		
			tamilarasu
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Tim,
Just thought of sharing this line without creating a variable.
sub Reload_Save
set docprop = ActiveDocument.GetProperties
Filename = docprop.FileName
Username = ActiveDocument.Evaluate("subfield(OSUser(),'\',2)")
ActiveDocument.Reload
ActiveDocument.SaveAs left(FileName, len(FileName)-4) & " " & Username & ".qvw"
end Sub
 karthickv
		
			karthickv
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Many thanks for your Response Tim. It worked. 
 karthickv
		
			karthickv
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thank you so much for your response.
Nanri Tamil.  
 
 tamilarasu
		
			tamilarasu
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		No problem bro.  Have a good day!!
 Have a good day!! 
