Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export table to Excel with a button

I would like to create a button for the user to export an entire table (not an image, the data) to Excel. When I create a button, and go to the Actions, the only possible thing that makes sense is "Export", but when I select that, I'm not offered the opportunity to select an entire table, just a list of fields, which is a pain from 1) a development point of view (every time I add a new field to the table, I'd have to remember to update the button), and 2) time.

Is there something simple I'm missing? I've seen elsewhere that this can be accomplished via a macro, but I'm wondering if there's a faster, easier way.

4 Replies
Not applicable
Author

Hi Kevinbmsr,

There is an inbuilt option in QV where you can right-click the table and select "Send to Excel" and it will export the table for you automatically.

Cheers,

Ravi

Not applicable
Author

Thanks, Ravi, I know about the "Send to Excel" option on the Layout page. My table is quite large, and I don't show it on the main sheet. I wanted the users to be able to enter the selection data (start/end dates, etc.), reload the table, and then click an "Export" button all from the "Main" sheet, without having to go to the sheet with the table on it. These people are not QV experts, and while it's pretty easy for you and I to select the "XL" icon, I wanted to make it as simple as possible for them. Enter, enter, click, and done - know what I mean?

Not applicable
Author

Hi Kevinbmsr,

I am afraid thats as simple as it gets. The other option is to use the simple macro which you may have come across already but I am pasting it here anyway if you wish to use it:

Sub exportToExcel()

Set obj = ActiveDocument.GetSheetObject("TB01")

obj.ExportBiff "C:\Test.xlsx"

Set obj = nothing

End Sub

Once you associated this macro with a button, your users can export the table with just a click

Cheers,

Ravi

Not applicable
Author

Thanks, Ravi. Sometimes you don't get the answer you want, but you get the answer you need!