|
|
|
 |
How to change the directory of the Save As dialog
|
Article contributed by Dave Rado and Jonathan West
The easiest and best way is to specify the path you want in the Name argument of the Dialogs object:
With Dialogs(wdDialogFileSaveAs)
.Name = "c:\windows\temp\"
.Show
End With
There are three advantages of using this method rather than methods such as ChangeFileOpenDirectory
or Options.DefaultFilePath: |
|
It's simpler |
|
It means you don't have to change the path back again afterwards to what it was before. |
|
If the document has already been saved once, it will always default to its current path,
unless you use the above method. |
Of course, you can use whichever folder you want in place of
c:\windows\temp\.
If you also want to preset the file name in the dialog with the current name of the active
document, use the following code:
With Dialogs(wdDialogFileSaveAs)
.Name = "C:\My Documents\" & ActiveDocument.Name
.Show
End With
Or (if path you want to set is the document's current path), you could
just use:
With Dialogs(wdDialogFileSaveAs)
.Name =ActiveDocument.FullName
.Show
End With
If you want to have the dialog preloaded with a different file name, then
put your preferred filename there in place of ActiveDocument.Name,
e.g.:
With Dialogs(wdDialogFileSaveAs)
.Name = "C:\My Documents\temp.doc"
.Show
End With
|