Excel macro to execute Access query

D

Denise

Can I execute an Access query from an Excel Macro and bring back the data
into the spreadsheet?
 
J

Joel

The best way to start is to record a macro while setting up the query manually.

From Worksheet menu
1) Tools - Macro - Record new macro
2) Data - Import External Data - New Database Query
3) Tools - Macro - Stop Recording.
 
F

FSt1

hi,
technically this built into xl via microsoft query.
2003 on the menu bar....data>inport external data>new database query
set access db as the data source.
scroll to your access db.
when the table source apears, scroll down to the query and pull all of the
queries fields into MSQ then just follow the rest of the wizzard.

regards
FSt1
 
R

Ronald R. Dodge, Jr.

I have attempted to use MS Query in the past with XL97, XL2000, and XL2002
only to run into Excel crashing on account that MS Query uses ADO, and
within Excel, there is a documented issue with memory leaks when using ADO.
I don't know if this issue has been fixed in XL2007 or not, but it is
documented for prior versions.

--
Thanks,

Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
 

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