Save As from Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to export a query to an Excel file, in a location that the user
can choose.

I know the FileDialog command does not support Save As, and I would like to
steer away from API calls if at all possible.

Do I have any other options? If not, could someone please explain where I
put the Function for the API call?

Thanks in advance!
Kevin
 
Kevin said:
I'm trying to export a query to an Excel file, in a location that the
user can choose.

I know the FileDialog command does not support Save As, and I would
like to steer away from API calls if at all possible.

Do I have any other options? If not, could someone please explain
where I put the Function for the API call?

Thanks in advance!
Kevin

I think calling the Windows API is actually your best bet -- either the
File Open/Save dialog or the Browse for Folder dialog, whichever is
appropriate. See the code and examples on these pages:

www.mvps.org/access/api/api0001.htm
www.mvps.org/access/api/api0002.htm
 
Dirk,

Thanks for the response- I was afraid that was the answer! I've seen the
link to this page in other responses, but I'm confused as to where to paste
this code. Do I just copy everything in the blue box into the code behind my
button? What about the syntax at the top?

Thanks again,
Kevin
 
Kevin said:
Dirk,

Thanks for the response- I was afraid that was the answer! I've seen
the link to this page in other responses, but I'm confused as to
where to paste this code. Do I just copy everything in the blue box
into the code behind my button? What about the syntax at the top?

Copy everything from the "*** Code Start ***" line to the "*** Code End
***" line and paste it into a new standard module. If you're using the
File Open/Save code (api0001.htm), save that module as "basFileOpenSave"
(or any other name that seems suitable to you -- just don't use the same
name as anything else, or any of the procedures in the module itself).
If you're using the Browse Folder code (api0002.htm), I suggest you name
the module "basBrowseFolder".

The code behind your button will be modeled on the example code at the
top of the page (not in the module itself), which calls the code
procedures that are defined in the module you created.
 
Thanks, Dirk,

I greatly appreciate the help! I've done a lot of coding, but never gotten
into calling procudures, so this helps.

Thanks and have a great New Year!
-Kevin
 
Back
Top