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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

specifying location to save a csv file to

Status
Not open for further replies.

galorin

MIS
Nov 22, 2007
154
GB
I have a form with a button that exports a CSV list of addresses for a Mail Merge. How do I access the "Save As" dialog so the user can specify a location to save the file, rather than just arbitrarily putting it somewhere?
 
That's a big mes of code that I was hoping to avoid. How do I get the environmental variables, like %HOMEPATH% or %USERPROFILE% and set these as a hardcoded location for saving the CSV file to?
 
Yes, it is a lot of code, however, there is nothing you need to modify to make it work. You only need to paste it into a module in the modules tab of the access window. After that, you call the fGetFileName in your form's code such as on click event. For example, this is a statement I use that calls the function(s) and then extracts a portion of the file name.


MBAFileDate = Right(fGetFileName(), 8) 'Choose any Current file and extract the date extension

This brings up the common file save dialog box and then the user clicks on a file and the information about the file is saved to a variable.

Your second post indicates you want to hard code the values, so not clear whether you want the user to be able to choose the file or to predefine the file.
 
I'll try putting it in as a module,and see how it goes.

Hard-coding a download location would have been for sending the created CSV to the user's desktop, no matter what their username is. As is,it's going straight to C:\Address.csv
 
Why not using the "All users" desktop ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top