GetSaveAsFilename

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EByker
    New Member
    • Apr 2007
    • 18

    GetSaveAsFilename

    This is an extract from a working(!) VBA programme in Excel.

    Code:
        fs = Application.GetSaveAsFilename("C:\Data")
    What is the equivalent VBA code for Word? I cannot find it! Any help would be appreciated.

    Thanks

    Bertie
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    I'm far from expert in this area, but I don't think there is a direct equivalent. You might need to play with the FileDialog object to produce something similar.

    Comment

    • EByker
      New Member
      • Apr 2007
      • 18

      #3
      Originally posted by Killer42
      I'm far from expert in this area, but I don't think there is a direct equivalent. You might need to play with the FileDialog object to produce something similar.
      I have, but with no success so far; hence my plea for help ...

      Thanks anyway.

      B

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Well, I just wrote this macro in Excel, then tried it in Word. It worked in both.
        Code:
        Sub aaa()
          Dim fd As FileDialog
          Dim fn As String
          
          ' Create a FileDialog object as a File Picker dialog box.
          Set fd = Application.FileDialog(msoFileDialogFilePicker)
        
          With fd
            .AllowMultiSelect = False
            .InitialFileName = "C:\Data"
            .Title = "Save As..."
            .Show
            fn = .SelectedItems(1)
          End With
          Set fd = Nothing
          Debug.Print "Selected file = ["; fn; "]"
        End Sub

        Comment

        • EByker
          New Member
          • Apr 2007
          • 18

          #5
          Thanks! Works fine.

          B

          Comment

          Working...