Announcement

Collapse
No announcement yet.

vba save as dialog box...

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • vba save as dialog box...

    vba save as dialog box...

    i would like to create with vba the file save as dialog box...and then let the user name and save the file wherever they want to...

    thank you...!

  • #2
    Look up the Function [GetSaveAsFilename]

    Whilst in the VBA Editor Press F1 and type in GetSaveAsFilename

    Post back if you need further help
    Kind Regards,
    Ivan F Moala From the City of Sails

    http://www.xcelfiles.com

    Comment


    • #3
      seems to work...(what was i doing...--thanks!

      and now, how can i manipulate the "Save In" and "File Name" and "Save as Type" comboboxes...?

      thank you!

      Comment


      • #4
        ok...

        the dialog returns fiine, the fileSaveName always returns false and doesn't save the file...?

        thanks.

        Comment


        • #5
          The dialog will just return the filename (and path) that was selected. It's up to you to then save the file with another line of code. If False is returned, that means the Cancel key was used to terminate the dialog.
          Please do not U2U (private message) me directly for questions that should be posted to the forum; any such U2Us will be ignored.

          Comment


          • #6
            thank you...

            this works if is save the file, but not if i select the cancel button...(thank you!)
            ChDir "c:\Documents and Settings\Mark Schukas\My Documents\mjs\math\"
            fileSaveName = Application.GetSaveAsFilename( _
            fileFilter:="xls Files (*.xls), *.xls")
            ActiveWorkbook.SaveAs
            If fileSaveName <> False Then
            End If

            Comment


            • #7
              Hi

              Change this to

              Code:
              Sub YourMacro()
              Dim fileSaveName as String
              
              'OTHER CODE
              
              If fileSaveName <> "False" Then
              'OTHER CODE
              End If
              
              End Sub

              Comment


              • #8
                thank you...!

                with a slight modification, this seems to work (a lot of fiddling just to get the file save as dialog box running...!)--thank you!

                Dim filename As String
                ChDir "c:\Documents and Settings\Mark Schukas\My Documents\mjs\math\"

                fileSaveName = Application.GetSaveAsFilename( _
                fileFilter:="xls Files (*.xls), *.xls")


                If fileSaveName <> "False" Then
                ActiveWorkbook.SaveAs
                End If

                Comment


                • #9
                  I think you want

                  If fileSaveName <> "False" Then
                  ActiveWorkbook.SaveAs fileSaveName
                  End If
                  Please do not U2U (private message) me directly for questions that should be posted to the forum; any such U2Us will be ignored.

                  Comment

                  Working...
                  X