General discussion

Locked

File navigation window in VBA

By jensr ·
I'm currently writing a macro in Excel 97 that retrieves and stores data in two different, but changing folders, so I need to be able to let users change the working directory easily (ChDir - command). So i need to either:
1) Set the working directory by a explorer window or something similar
2) be able to pop-up the Save as window when saving a workbook from VBA
Any suggestions??

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

File navigation window in VBA

by ceber In reply to File navigation window in ...

Try the GetSaveAsFilename method (application object). That will pop up the save as box without actually saving anything...just returns what the user entered.

Collapse -

File navigation window in VBA

by jensr In reply to File navigation window in ...

Thanks for your quick reply. Guess i should have known, but our object browser has crashed here, and i was i bad need of getting it sorted. Thnx

Collapse -

File navigation window in VBA

by Lo In reply to File navigation window in ...

Hi - I think I am missing something in your question, but ... You can use the VBA ChDir function to set the directory, does the same thing for the application as from DOS. You can get the current directory, save it to a variable, set to whatever for the two work directories and set back. You can ask the user for the file name and directory in an input box (or whatever) and do the save for them. There is probably a way to call the SaveAs, setting the device and directory properties (disabled, if you want) but that is just a guess. If not, you can write your own with drive, directory and file controls and enable/disable/load them as necessary (I think this is available in VBA, it's in VB).

Collapse -

File navigation window in VBA

by jensr In reply to File navigation window in ...

Yup you're right. I'm going to combine your answer with the one above. If i use a SaveAs box for saving, and then redirects the working direcotry back to the previously selected one with a variable, it should work pretty well. Thnx for your input

Collapse -

File navigation window in VBA

by jensr In reply to File navigation window in ...

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums