Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
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
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
Many thanks for your Response Tim. It worked.
Thank you so much for your response.
Nanri Tamil.
No problem bro. Have a good day!!