Access to Excel: execute a macro saved as a string.

J

jfp

I have an Access app that manipulates a spreadsheet. The spreadsheet
can be in one of several pre-defined formats. For each, i have recorded
in Excel a macro that performs the necessary re-formatting. I have
stored these as strings in a table. I want to:
1) based on user choice, create a spreadsheet in one of the possible
formats,
2) open it and then play the appropriate macro

My VBA code (in Access) looks like this:

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Open( ... Name of spreadsheet ... )

Now, if the text of the macro is in a string variable (call it
strMacro), what do i call in the Excel object model to execute 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