J
John B
I would like to know if there is any way to invoke automation commands at
runtime on an application object using vba. Specifically the saveas command.
The issue is that the syntax depends on the specific application and I would
like a generic method that could be initialized at runtime since I don't know
until runtime what app the user is going to be running. What I have now is
... if AppName = "Word" then
objApp.Application.ActiveDocument.SaveAs strFile
elseif AppName = "Excel" then
objApp.Application.ActiveWorksheet.SaveAs strFile
etc
What I would like is something like
objApp.Application.Invoke "ActiveDocument.SaveAs " & strFile
where the correct string for "ActiveDocument.SaveAs" could be inserted
at runtime.
Application.Run "ActiveDocument.Saveas" doesn't work
runtime on an application object using vba. Specifically the saveas command.
The issue is that the syntax depends on the specific application and I would
like a generic method that could be initialized at runtime since I don't know
until runtime what app the user is going to be running. What I have now is
... if AppName = "Word" then
objApp.Application.ActiveDocument.SaveAs strFile
elseif AppName = "Excel" then
objApp.Application.ActiveWorksheet.SaveAs strFile
etc
What I would like is something like
objApp.Application.Invoke "ActiveDocument.SaveAs " & strFile
where the correct string for "ActiveDocument.SaveAs" could be inserted
at runtime.
Application.Run "ActiveDocument.Saveas" doesn't work