PDA

View Full Version : Solved: Index for Macros



vanhunk
07-06-2012, 01:37 AM
Hi there,

CAN THIS BE DONE:

I have a large number of subroutines (macros) in a workbook. I would like to create an index in a spreadsheet with the macro name in one column and the description in the adjacent column.

I want to be able to click on the name of the macro and want the focus to be taken to the code of the "clicked" macro.

Thanks

Sub MacroX() Description => Code of MacroX()

CodeNinja
07-06-2012, 06:09 AM
You are looking to use VBE to accomplish this... I believe it can be done, although I haven't played with setting the focus within the module / sheet.

Great references are :
http://www.cpearson.com/excel/vbe.aspx

and:
http://vbaexpress.com/forum/showthread.php?t=9586

Sample code that gets you close is:
***Be sure to set reference for Exstensibility***

Sub test()
' requires microsoft Visual Basic for Applications Exstensibility 5.3
Dim vbProj As VBIDE.VBProject
Dim vbComp As VBIDE.VBComponent

Set vbProj = ActiveWorkbook.VBProject
Set vbComp = vbProj.VBComponents("Module1")

vbComp.Activate


End Sub

Good luck.

snb
07-06-2012, 06:58 AM
Have a look over here (http://www.snb-vba.eu/VBA_Excel_VBproject_en.html#L55).

vanhunk
08-23-2012, 04:05 AM
Have a look over here (http://www.snb-vba.eu/VBA_Excel_VBproject_en.html#L55).
Thanks a million.