LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Set Location and Filename to replace GetOpenFilename

I currently have code that when the macro is executed, allows the user to
choose the file needed to write data to. I wrote it this way as I will be
sending the file out to multiple locations and cannot control where the user
may place the file. Here is the code that allows the user to choose the
location and filename:

Do
fName = Application.GetOpenFilename
Loop Until fName < False
Set BonusFile = Workbooks.Open(Filename:=fName)

What I would like to do is have the user, on first use of the macro, go to
the location where they initially saved the file and open it, but then have a
message box open and ask the user if they would like to save this path and
filename as the default location and filename.
If they answer yes, the macro would save the specific path to the file and
then specific filename in the macro and have the macro use this path and
filename in the future without the user having to open the file manually
again.
There would probably need to be a trap so that if the file is renamed or
moved after the location is created, the macro would go back to letting the
user once again choose the location and file, but when chosen, would then ask
if the user wants to set the path and filename again.

Can you help with this?
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using filename retrieved from GetOpenFilename Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 2 September 12th 08 07:47 PM
Separating Location and Filename in a cell Jim Jackson Excel Worksheet Functions 4 December 27th 06 07:27 PM
"the file already exsists in this location do you want to replace. jenn Excel Discussion (Misc queries) 7 October 9th 06 07:19 PM
Formula to replace invalid filename characters tschultz Excel Worksheet Functions 2 January 27th 06 07:07 PM
Find & replace a value in an unknown cell location mellowe Excel Discussion (Misc queries) 2 November 20th 05 09:17 PM


All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"