Run an Excel macro from Access

O

OceansideDJ

My code selects records into a table, saves them to an Excel spreadsheet, and
opens it in Excel.

I then do some simple formatting in Excel that I would like to automate. I
have saved the formatting steps in an Excel macro. Can I get Access to create
and run the formatting macro? I would also like to leave the worksheet
macro-free to reduced virus fears.

Thanks,

Mike
 
C

ChrisJ

You should be able to take the macro code stored in Excel,
paste it into your existing routine, and with a few
changes run the code in Access.
Place the code after you have opened Excel.
You will then not need the macro to exist in Excel
 
L

LarryP

ChrisJ is correct, although the "few changes" can be
challenging the first time or two. You have to create an
object at the Access end for just about everything you
want to manipulate in Excel. Object for Excel itself,
Object for the File (Workbook) you are opening, Object for
any Range you want to select, etc., etc. Once you've done
that, most of the Properties and Methods can be handled
very much as you would within Excel. Good luck!
 
O

OceansideDJ

Thanks, ChrisJ and LarryP. Along with the Copy cells from Excel thread, I
think i have it.
 

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