getting save as file name in word

I didn't realize that Word doesn't have GetSaveAsFileName or GetOpenFileName methods (which Excel has). But it doesn't. Instead you can try the SaveAs FileDialog (2003, 2007, 2010):

Sub ShowSaveAsDialog()
Dim dlgSaveAs As FileDialog
Set dlgSaveAs = Application.FileDialog(FileDialogType:=msoFileDialogSaveAs)
dlgSaveAs.Show
End Sub

You can provide a default path including filename like so to the dialog, ie

Sub SaveName()
    Dim strFileName As String
    Dim StrPath As String
    'provide default filename
    StrPath = "c:\temp\test.docx"
    With Dialogs(wdDialogFileSaveAs)
        .Name = StrPath
        If .Display <> 0 Then
            strFileName = .Name
        Else
            strFileName = "User Cancelled"
        End If
    End With
    MsgBox strFileName
End Sub

Tags:

Ms Word

Vba

Save