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

Running some code in an excel spreadsheet using VB

Status
Not open for further replies.

Dawhyte

MIS
Dec 6, 2002
3
GB
Hi,

Does anyone know how to use VB to call code that's placed behind a button on an excel spreadsheet ?

e.g Have a 'Sheet1' with a button...the sub behind this button is called 'Sub CommandButton1_Click'...i want to access this code ....

Creating a macro to point to this code is not the best solution for me....as i`m scripting something which loops through lots and lots of excel workbooks.

Any ideas ?

Thanks

Derek

 
I'd try to copy that code from the workbook and put in into your VB module. That's always worked better for me.

The only time I left code in a workbook when I was running a VB program was when I was doing a DDE interface, then I had the macro fire automatically at startup.

-----
The death of dogma is the birth of reason.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top