Q

How do I create a macro that can create a file that includes another macro in it?

I currently have a macro in Excel that creates an Excel template by importing a text file into the spreadsheet and then saving it as a template. I want the template to have a macro in it that does something different. How do I create a macro that can create a file that includes a macro in it?
Interesting question. What you'd have to do is write a macro to parse up your text file and as part of that macro, write the macro you want to write. Is that recursive enough for you? What you are going to have to do is manipulate the Visual Basic Editor 6.0 Object Model to drive your macro creation. In Office XP Developer, the Visual Basic Editor 6.0 Object Model is discussed under the Microsoft Office XP Developer Object Model Guide, Shared Components section of the documentation. The ins and outs are in the VBOB6.CHM help file. When you install Office XP, make sure to check that you want all the programming help/VBA files installed so you get it installed.
This was first published in December 2001
This Content Component encountered an error

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchExchange

SearchSQLServer

SearchWinIT

SearchEnterpriseDesktop

SearchVirtualDesktop

Close