Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to use file browser to save file

Status
Not open for further replies.

WantsToLearn

Programmer
Feb 15, 2003
147
US
I am using Access97 to control Excel via automation. I have been able to get Access to open a specified file and make changes. It uses the Windows file browser to let the user select the file to process.

After changes are made, I want to save it with a different name or to a different folder so the original is maintained. Are there flags in the Windows file browser you can set to prevent overwriting the existing file?

When I give it a file name to save as, it doesn't seem to connect it with the Excel file I have open. Any ideas on this problem?

Thanks for the help!

 
You haven't stated the whole situation. When you open a file with automation why would you need the common dialog? Do you use the return from the common dialog as the file being processed with automation? Have you made the file visible? If you don't want to overwrite why not just automatically save in the same directory with a date or incremented number like FileToOpen.xls to FileToOpen1.xls? This code would be relatively straight forward.

-------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
 
Thanks for the help SCKing. After digging around over the weekend I realized that the Windows file browser doesn't actually save the file, it just returns a valid path and any file name the user selected or typed in.

The reason for doing it this way is because the user already has a system in place with Add, Change and Delete subfolders off of a network drive. Using a parm, I can popup the file browser with the pathing already set as far as I can go without Add, Change or Delete. The user then selects the rest of the path and the file name she wants to uses to save the file. If the path has changed, it can be the same name.

Thanks again for your help!
 
Although the browser only returns the filename you could also consider using the SaveAs dialog to save your files.
-------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top