Results 1 to 3 of 3

Thread: Default Folder

  1. #1
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts

    Thumbs up Default Folder

    From time to time when running a macro and I open up a new workbook, I new folder is selected

    I would like to default to My Documents

    I am using office 2010 and Windows 7

    It would be appreciated if you would assist me

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts
    Does something like this do what you want?

    Code:
    'Define variables
    Dim sFileToOpen As String
    Dim sCurDir As String
    'Get Current Directory
    sCurDir = CurDir
    'Change directory to desired default
    ChDir ("c:\MyDocuments") 
    'Get file name to open
    sFileToOpen = Application.GetOpenFilename
    'reset original directory
    ChDir (sCurDir)
    Steve

  3. #3
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts
    Hi Steve

    Thanks for the help, much appreciated

Posting Permissions

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