+ Reply to Thread
Results 1 to 2 of 2

RE: how set default path?

  1. #1
    JMB
    Guest

    RE: how set default path?

    You could use Chdir to set the active directory before using getopenfilename.


    "Ian Elliott" wrote:

    > Thanks for any help.
    > I have a macro in a workbook that opens a workbook, gets some numbers out of
    > it, then opens another workbook, and puts the numbers in.
    > I could do this by hand, but there are about 15 numbers, and for once a day,
    > so I figure I can save some time by automating it.
    > The way I open the file is use getOpenFilename.
    > The thing is, everytime I run the macro, I have to change to the directory.
    > And the file I need is 4 or 5 folders down. Which takes a couple of seconds.
    > So I figure there is gotta be some way to set the default path so that when I
    > do the getOpenFilename method, it already shows the path I set in the code
    > just before that.
    > Here's the code:
    > ...
    > MyFile = Application.GetOpenFilename("Microsoft Excel Application (*.xls),
    > *.mdb", , , , False)
    > Workbooks.Open MyFile
    > 'get numbers
    > MyFile = Application.GetOpenFilename("Microsoft Excel Application (*.xls),
    > *.mdb", , , , False)
    > Workbooks.Open MyFile
    > 'write numbers
    > I typically do this batch, for about 20 files one after another, so I only
    > have to set the folder the first time, but since I do the GetOpenFilename
    > method twice, each time I have to do about 5 or 6 clicks to get back to that
    > directory.
    > Is there someway to set the path so that when the dialog box opens, the path
    > is already set?
    > Another way I thought of doing this is not using getOpenFilename but
    > somekind of inputBox and a path, but I would like to try it this way.
    > Thanks again.
    >


  2. #2
    Registered User
    Join Date
    01-31-2006
    Location
    Washington State
    Posts
    10

    Thumbs up ChDir works well

    Thanks for that input!

+ 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