Export report data to Excel

spectrum

Registered User.
Local time
Today, 21:53
Joined
Jan 22, 2012
Messages
27
I am using Access 2010. I have a dynamic report generator form, it fills a listbox filtered with user selections, and the listbox recordsource is used for the printed Access report. However I am now trying to send the report data to Excel. I tried using the command button wizard, selecting Report Actions/Send report to a file. Unfortunately it worked but made a macro which I could not convert to VB.

Does anyone know what the vb content is in the macro.

Thanks
 
A good start would be to post a screenshot of the macro.

However, is the built-in Export to Excel button not sufficient for your needs?
 
Thanks for coming back to me. Macros in 2010 and me generally are things I have not worked with before. In 2010 the macro design section opens up in a full page of just headings. Maybe I should read up a bit more, I was just hoping there would be a VB equivelent to what's in the macro thats been made by the wizard. All I did was select Report Actions, then Send report to file, it asked me what was the report page/name in which I entered QueryForm2, and that was it, the wizard cleverly put it all together but I like VB, don't like macro's. Thanks again
 
I tried to insert a picture, but do not have a URL. My macro looks like this

ExportWithFormatting
Object Type Report
Output Format
Output File
Auto Start No
Template File
Encoding 0
Output Quality Print

Don't know if that is any help?
 
It looks like the OutputTo method. Zip the image and upload the zipped doc. That will work.
 
Thanks again. All I could do was screenprint and copy what I could see. I must look into how I upload to the site. However, instead of using the macro wizard, I created one, copying what I could see in it's contents posted on the forum, saved it, and then found the convert to vb tab was enabled. I onverted it and hey presto you were correct.

DoCmd.OutputTo acOutputReport, "QueryForm2", "", "", False, "", , acExportQualityPrint

So many thanks for your help
 
Good to see you managed to convert the code and get it working.

I would advise you replace it with this:
Code:
DoCmd.OutputTo acOutputReport, "QueryForm2", acFormatXLS, , False, , , acExportQualityPrint
 
Many thanks, okay I will use your code. Mine does look a bit empty!!

Thanks again for help
 
It's pretty much the same but mine explicitly declares the acFormatXLS format and I don't use "" in the empty parameters.
 

Users who are viewing this thread

Back
Top Bottom