The following methods should work in both Word 97 and 2003. From the
simplest to the most complex code, this first method will save the current
document to the current directory:
ActiveDocument.SaveAs
Note that if you have not yet saved the document, Word will simply assign it
a name in the "Doc1," "Doc2," etc. type format. If you've given the document
a name, it will use that name.
If you want the user to name the document to be saved, the following code is
necessary:
'Decllare your variable as a string
Dim myFilename As String
'Give your user an input box to enter the name of the file
myFilename = InputBox("Enter name you wish to assign to the file")
'Save the document using the file name assigned
ActiveDocument.SaveAs FileName:=myFilename
Again, using this code, the named file will be saved to the current
directory. If you want to change to a specific directory, use this code:
Dim myFilename As String
myFilename = InputBox("Enter name you wish to assign to the file")
'Change the directory path; make sure you enter the last backslash to
insure
'the file goes to the proper directory; since your directory path will
differ frmo 'the one used in the example, simply change the code to reflect
the correct 'directory on your computer
Application.ChangeFileOpenDirectory "C:\Documents and
Settings\leew\Protected Documents\"
ActiveDocument.SaveAs FileName:=myFilename
Finally, if you want the user to have control over both the filename and the
directory to which it is to be saved, the following code does that:
Dim myFilename As String
Dim myDirectory As String
myFilename = InputBox("Enter name you wish to assign to the file")
myDirectory = InputBox("Enter path, including any subfolders, where to
save file; i.e., 'C:\Documents and Settings\leew\Protected Documents\'")
ActiveDocument.SaveAs FileName:=myDirectory & myFilename
Hope this is helpful!