chigh
asked on
Using MS Word FileSaveAs macro from the command line.
How do I start MS Word from the command line and instruct it to save a specified *.rtf file as a *.doc file without having to make additional keyboard or mouse entries?
I'm trying to start Word with the FileSaveAs macro ...
Winword.exe /mFileSaveAs MyFile.rtf
... and I want Word to create MyFile.doc. But when it runs the macro, it pops up the "Save As" window, requiring operator interaction. Is there a way I can tell the FileSaveAs macro what to do from the command line?
My environment is Windows 2000, MS Word 2000.
I'm trying to start Word with the FileSaveAs macro ...
Winword.exe /mFileSaveAs MyFile.rtf
... and I want Word to create MyFile.doc. But when it runs the macro, it pops up the "Save As" window, requiring operator interaction. Is there a way I can tell the FileSaveAs macro what to do from the command line?
My environment is Windows 2000, MS Word 2000.
Write your macro like this:
Sub MyFileSave()
Dim strName As String
Dim strStem As String
Dim strNewName As String
strName = ActiveDocument.Name
strStem = Split(strName, ".")(0)
strNewName = strStem & ".rtf"
ActiveDocument.SaveAs strNewName, wdFormatRTF
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ActiveDocument.SaveAs FileName:=strvariable & ".doc", FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False
False, SaveNativePictureFormat:=F
SaveAsAOCELetter:=False