Run an Excel macro from Access

  • Thread starter Thread starter OceansideDJ
  • Start date Start date
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
 
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
 
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!
 
Thanks, ChrisJ and LarryP. Along with the Copy cells from Excel thread, I
think i have it.
 
Back
Top