I have seen sample workbooks that would have a button with text:
Click here to view code
what is the code that takes us to a specific sub routine??
I have seen sample workbooks that would have a button with text:
Click here to view code
what is the code that takes us to a specific sub routine??
Paul
Hello Paul,
The following macro will display the code for any Sub or Function procedure in the Active Workbook. Place this code in a Standard VBA Module, and then add a reference to the VBA Extensibility library. I have included how to this below, in case you aren't familiar with how to do this. Replace the code in Blue with Module name of the macro, and the procedure name. You can then call this macro from a button to display the code. The Visual Basic Editor is automatically opened when the macro is run.
Macro Code:
To Install the Macro:![]()
Please Login or Register to view this content.
1. Copy the Macro code above using CTRL+C
2. Open Excel and Right Click on any Sheet Tab
3. Click on View Code in the pop up menu
4. Use ALT+I to activate the VBE Insert Menu
5. Press the letter m to insert a Standard Module
6. Paste the macro code using CTRL+V
7. Save the macro using CTRL+S
8. Close the VBE and return to excel using ALT+Q
Setting a VBA ProjectLibrary Reference
1. Open Excel and press ALT+F11 to open the Visual Basic Editor (VBE).
2. Press ALT+T to activate the Tools Menu.
3. Press r to show the Refernces Dialog.
4. Scroll through the list to find Microsoft Visual Basic for Applications Extensibility x.x
5. Click the Check box to select it. You should see a checkmark.
6. Click OK
7. Press CTRL+S to Save the Reference in your project
8. Press ALT+Q to Close the VBE and return to Excel.
Sincerely,
Leith Ross
Last edited by Leith Ross; 08-13-2007 at 02:15 AM. Reason: Had wrong library refernce listed. Was Outlook Object Library
Thanks Lieth,
I have done all you have writen and still get a problem here
method vbe of object_application Failed![]()
Please Login or Register to view this content.
this is what my code looks like now
![]()
Please Login or Register to view this content.
Okay, now I don't get that error because I went to security and checked off trust access to vb projects
but now I have an error
sub or function not defined![]()
Please Login or Register to view this content.
Could it be because I am trying to get to the workbook module??
Hello Paul,
I have been out most of the day. Thanks for mentioning the security settings. The problem is a simple one. When you use the procedure name don't include the Private, Public Sub, Function keywords, or parentheses.
Sincerely,![]()
Please Login or Register to view this content.
Leith Ross
Thank you very much,
Works like a charm
Hello Leith,
I found this tread recently although it was a while back when you commented on this topic.
I am trying to use that VBA Extensibility Library to find and replace code within other Macros with user input values (these would be dates)
What I want it to do is have the macro bring up a dialog box for the date to find then another dialog box to bring up the replace date, and then do the action to specified macros in the project.
It has to be a classic FIND AND REPLACE given the structure of the ODBC Arrary that it will be references. I ususally do this change manually by going in and just executing a find and replace on the individual macro's but there are many of them that need to be changed and I am looking for a shortcut to do them all at once.
Can someone or yourself help me with this.
thanks
Vaughn
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks