![]() |
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. |
All times are GMT +1. The time now is 05:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com