Macro or VB code to Export data to an Excel file?

B

BobC

I have a query that assembles the data that I would like to routinely
export as an Excel file to a specific file location.

I would like it such that various users can 'just press a button' so to
speak and get the most current data from the database for use in an
Excel Pivot Table.

I would like either or both a Macro or VB code to do this. When I
looked at the Macro options this was not obvious?

Bob
 
S

Steve

Take a look at the TransferSpreadsheet function in the Help file.

Steve
(e-mail address removed)
 
S

Steve

Before proceding, post your relevant tables and I will analyze and comment.

Steve
(e-mail address removed)
 
A

Arvin Meyer [MVP]

Steve Santus basically haunts these newsgroups looking for business. He was
caught by the poster who answered him. Good professional quality help is
here for free.
 
J

John W. Vinson

I suspect I am mission out on something here?

Steve is notorious for using these groups to troll for unsuspecting potential
customers. Unlike 99+% of the other volunteers who answer here, he considers
it appropriate to solicit paid business. John (and a few other people) post
responses to these solicitations to warn folks that Steve's proposals should
be carefully examined.
 
A

Arvin Meyer [MVP]

You can use the Transfer Spreadsheet function on your query. The button code
would be something like:

Private Sub MyButton_Click()
DoCmd.TransferSpreadsheet acExport, _
acSpreadsheetTypeExcel9, "QueryName", _
"C:\Test.xls",, "MyName"
End Sub

Just for your information, acSpreadsheetTypeExcel9 is Excel 97 which should
be readable by later versions, but you can also export to a later format.
 
B

BobC

Thanks John!

You have helped me more than once (without making look totally stupid)
and I appreciate it. I write, or try to write code only when I need to.
That give me plenty of time to forget before I need help again!
As I said (above), you and several others do a lot of good helping out!

THANKS MUCH!
Bob
 
B

BobC

This is certainly scary!
It worked the first time!
Thank You Very Much!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Bob
 

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