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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a description to an Excel Macro created by a script 1

Status
Not open for further replies.

drlex

Technical User
Jul 3, 2002
3,295
GB
Greetings, all.

I have a small problem that I cannot find a solution for - it is Friday afternoon and my google-fu is weak.

I am adding a macro to a spreadsheet by way of VB script, using the code
Code:
   Set xlmodule = objExcel.Workbooks(1).VBProject.VBComponents.Add(1) 
   xlmodule.CodeModule.AddFromString strCode
   Set xlmodule = Nothing
where strCode contains the macro. What I'd like to do is add a description that is visible to the user of the spreadsheet when they select the macro to run.
Do I need to add the description to the macro code in strCode or is there a VBComponents command I need to use?


Many thanks & happy Friday,
lex

soi la, soi carré
 
Hi Lex - looks like its under application.macrooptions


Application.MacroOptions Macro:="MacroName", Description:="Description Here", ShortcutKey:=""

So if you know the name of the macro that's beeing created, you can add the description afterwards by the looks of it

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Geoff,
You're a National treasure - have a virtual pint! I can now skip home happily, knowing users will be less confused as a result.
Nice one, chap!
Lex

soi la, soi carré
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top