View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_4_] Jim Thomlinson[_4_] is offline
external usenet poster
 
Posts: 1,119
Default Importing a macro programatically

Give this site a look...

http://www.cpearson.com/excel/vbe.htm

It might be just the ticket.
--
HTH...

Jim Thomlinson


" wrote:

I have a conundrum. My application loads a csv file into excel and does
some bits and bobs to it. In doing so it imports a macro from a text
file runs the code and exports it again That works fine. However it
does this before displaying the data sheet.

What I want to do is to import some code which will remain active and
allow the user to interact once it is loaded. I also import a worksheet
as a summary page during the process and have tried importing a macro
with this. This imports but the scope of the macro is such that I
cannot use it to manipulate another sheet.

If I use an add-in I would need to reference the addin in teh
workbook. The workbook is created new each time and so this wouldn't
work. Can I make a macro in a worksheet become public?

COuld I move it programatically to the other sheet I need to use it in?
The application cunningly removes all extraneous modules added as it is
working so even if I could add a new module it would get removed.

Could I add a procedure to the existing module? It is a complex issue
and I hope I have made it clear. I am limited by the way the
application works and cannot re-write that as it would upset everything
else!
John Robinson