Path property

L

Lee

I am trying to output a query to Excel and save it. Here
is the code I am using:

DoCmd.OutputTo acOutputQuery, "qrydatamrg", acFormatXLS,
Application.CurrentProject.Path & "Tally.xls", False

The code works, but I expected it to save in the same
folder as the database, but it saves in the next level
folder. In other words, if my application is located at
"c:\test\test name," it saves the spreadsheet in "test"
folder rather than "test name" folder. It also adds the
name of the folder where it is located, so instead of a
spreadsheet named "Tally.xls" which is what I want, I end
up with something like "test name Tally.xls".

What am I doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top