+ Reply to Thread
Results 1 to 2 of 2

Saving in wrong location

Hybrid View

  1. #1
    Registered User
    Join Date
    06-22-2005
    Location
    Washington, USA
    MS-Off Ver
    Office 365
    Posts
    40
    So it turns out (a month later ) that this doesn't actually work.

    I looked it up in the help topics and here's the description it gives:

    Displays the standard Save As dialog box and gets a file name from the user without actually saving any files.

    I'm not exactly sure what this method is for.

    So back to my original question:
    What if I don't want to specify the filename and leave it up to the user? I want to point it to a specific folder, but the user can name the file as they see fit.

    http://www.excelforum.com/showthread.php?t=576657

    -joel
    Last edited by VBA Noob; 10-02-2007 at 01:58 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Joel,

    The Save As Dialog provides you with an easy to use interface that you can customize. This macro below will change the directory before the dialog is shown. This allows you to view the sub folders and Excel files in the directory you have chosen. Change "NewDir" to the directory you want.
    Sub SaveFile()
    
      Dim FileName As String
      Dim OldDir As String
      Dim NewDir As String
    
        OldDir = Dir
        NewDir = "C:\Program Files"
        ChDir NewDir
    
          FileName = Application.Dialogs(xlDialogSaveAs).Show
            If FileName = "" Then GoTo Finished
    
          ActiveWorkbook.SaveAs Filename:=FileName
    
    Finished:
        ChDir OldDir
    
    End Sub
    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1