Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending / Loading A Macro

Status
Not open for further replies.

mavest

Programmer
Feb 27, 2003
54
US
Can a macro be sent / loaded into Excel?

We have an application that sends a string to a client's workbook. I have written a VBA macro for the client's workbook that processes the string and loads the data into a worksheet.

The problem is that the client's workbook must have this macro to make things work.

One possibility is to compile the macro into a VB dll, then the client's workbook is independent of the macro. But we would still have to incorporate this dll into our products installation tree.

My question is whether there is another or better solution, such as sending the macro to excel and telling excel to load it and execute.
 
Macros are just text, entered into a special area (modules). If you have a textfile on notepad you can copy it into a module in excel. I don't really grasp what you are doing but it sounds overly complicated....

Rgds, Geoff

"Three things are certain: Death, taxes and lost data. Guess which has occurred"

Please read FAQ222-2244 before you ask a question
 
Essentially I would like to do your procedure Automatically, i.e. have my application send text to a workbook's module section and have the text become a macro that I can then call. When I am done using the macro, I can delete it from the client's workbook. This way my client's workbook does not need to have a pre-existing macro.

To me, I doubt that Excel will allow this, because it sounds alot like implanting a virus. Just thought I'd enquire as an option to writing a VB dll.

Your are also correct that this sounds complicated, but it is because our application talks to Excel via a language called REXX. We can only do limited OLE stuff at a slow pace. By passing Excel a XML string with all the data to insert, I only need to do a single OLE call.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top