Use Excel VBA Code in Access

B

Ben

Is it possible to use the macro code from Excel in Access? I have an Excel
spreadsheet that when you click a button it goes to our company's databases
and pulls data down. I want to do the same thing with a command button on
Access, but want to use the same code. Is it possible?
 
J

Jeff Boyce

Ben

When you say "use the same code", are you referring to the sequence of
button clicks that Excel stores as a "macro", or to the actual code that is
executed, or to the specific SQL statement(s) that are used to select/return
specific data?

If the first, fughettaboudid! The keystrokes in Excel mean nothing in
Access.

If the second, ditto! The object model Excel uses is NOT the same object
model in Access, so referring to "Sheet3" in an Access procedure is
meaningless.

If the third, you can copy the SQL statement(s) from the queries you use and
paste them into the SQL window of an Access query.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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