Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
can i "call" a subroutine that is held in an add-in? all i know i can do
pertains to functions (not sub's): i can type, in a cell on a spreadsheet, =myfuntion(a,b) and it will return c in that cell. i want the equivalent of hitting a user-created button that i created (forms, button icon, referencing a subroutine in the list). the only difference is my subroutine (not function) will be within an add-in, not within a module. is this possible? thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mike,
Procedures of any sort, in an add-in or not, cannot change ANYTHING in the Excel environment when called directly or indirectly from a worksheet cell. If you just want to call a sub in the AddIn from other VBA code (not from a worksheet cell), use the Run method. E.g., Application.Run "MyAddIn.xla!MyMacro" -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "mike allen" wrote in message ... can i "call" a subroutine that is held in an add-in? all i know i can do pertains to functions (not sub's): i can type, in a cell on a spreadsheet, =myfuntion(a,b) and it will return c in that cell. i want the equivalent of hitting a user-created button that i created (forms, button icon, referencing a subroutine in the list). the only difference is my subroutine (not function) will be within an add-in, not within a module. is this possible? thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks for all of your help. i just can't get it to work for some reason.
it keeps telling me "The macro 'mike.xla!mike' cannot be found." i called everything "mike" so as to avoid picking the wrong thing. the xla is there and is loaded and contains a sub 'mike()' that simply has a msgbox. thx "Chip Pearson" wrote in message ... Mike, Procedures of any sort, in an add-in or not, cannot change ANYTHING in the Excel environment when called directly or indirectly from a worksheet cell. If you just want to call a sub in the AddIn from other VBA code (not from a worksheet cell), use the Run method. E.g., Application.Run "MyAddIn.xla!MyMacro" -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "mike allen" wrote in message ... can i "call" a subroutine that is held in an add-in? all i know i can do pertains to functions (not sub's): i can type, in a cell on a spreadsheet, =myfuntion(a,b) and it will return c in that cell. i want the equivalent of hitting a user-created button that i created (forms, button icon, referencing a subroutine in the list). the only difference is my subroutine (not function) will be within an add-in, not within a module. is this possible? thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try naming the macro something else. And if you used Mike as the Module name,
rename that to something unique, too: Mike.xla (addin name) ModMike (module name) MacMike (macro name) application.run "mike.xla!modmike.macmike" or application.run "mike.xla!macmike" If that doesn't help, share the line you tried. mike allen wrote: thanks for all of your help. i just can't get it to work for some reason. it keeps telling me "The macro 'mike.xla!mike' cannot be found." i called everything "mike" so as to avoid picking the wrong thing. the xla is there and is loaded and contains a sub 'mike()' that simply has a msgbox. thx "Chip Pearson" wrote in message ... Mike, Procedures of any sort, in an add-in or not, cannot change ANYTHING in the Excel environment when called directly or indirectly from a worksheet cell. If you just want to call a sub in the AddIn from other VBA code (not from a worksheet cell), use the Run method. E.g., Application.Run "MyAddIn.xla!MyMacro" -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "mike allen" wrote in message ... can i "call" a subroutine that is held in an add-in? all i know i can do pertains to functions (not sub's): i can type, in a cell on a spreadsheet, =myfuntion(a,b) and it will return c in that cell. i want the equivalent of hitting a user-created button that i created (forms, button icon, referencing a subroutine in the list). the only difference is my subroutine (not function) will be within an add-in, not within a module. is this possible? thanks -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
unbelievable! i got it to work by changing the name of the subroutine. one
thing i noticed is i can access the .xla (w/ password) directly in the vb editor where modules typically are found. is this normal or can i make it more difficult to even find the (password protected) .xla? i am worried about security. either way, this is great. thanks so much to all who assisted. "Dave Peterson" wrote in message ... Try naming the macro something else. And if you used Mike as the Module name, rename that to something unique, too: Mike.xla (addin name) ModMike (module name) MacMike (macro name) application.run "mike.xla!modmike.macmike" or application.run "mike.xla!macmike" If that doesn't help, share the line you tried. mike allen wrote: thanks for all of your help. i just can't get it to work for some reason. it keeps telling me "The macro 'mike.xla!mike' cannot be found." i called everything "mike" so as to avoid picking the wrong thing. the xla is there and is loaded and contains a sub 'mike()' that simply has a msgbox. thx "Chip Pearson" wrote in message ... Mike, Procedures of any sort, in an add-in or not, cannot change ANYTHING in the Excel environment when called directly or indirectly from a worksheet cell. If you just want to call a sub in the AddIn from other VBA code (not from a worksheet cell), use the Run method. E.g., Application.Run "MyAddIn.xla!MyMacro" -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "mike allen" wrote in message ... can i "call" a subroutine that is held in an add-in? all i know i can do pertains to functions (not sub's): i can type, in a cell on a spreadsheet, =myfuntion(a,b) and it will return c in that cell. i want the equivalent of hitting a user-created button that i created (forms, button icon, referencing a subroutine in the list). the only difference is my subroutine (not function) will be within an add-in, not within a module. is this possible? thanks -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can protect the project by:
Open the VBE select the project tools|VBAProject properties|Protection tab Give it a password. This will protect your code from casual intruders--not the dedicated. mike allen wrote: unbelievable! i got it to work by changing the name of the subroutine. one thing i noticed is i can access the .xla (w/ password) directly in the vb editor where modules typically are found. is this normal or can i make it more difficult to even find the (password protected) .xla? i am worried about security. either way, this is great. thanks so much to all who assisted. "Dave Peterson" wrote in message ... Try naming the macro something else. And if you used Mike as the Module name, rename that to something unique, too: Mike.xla (addin name) ModMike (module name) MacMike (macro name) application.run "mike.xla!modmike.macmike" or application.run "mike.xla!macmike" If that doesn't help, share the line you tried. mike allen wrote: thanks for all of your help. i just can't get it to work for some reason. it keeps telling me "The macro 'mike.xla!mike' cannot be found." i called everything "mike" so as to avoid picking the wrong thing. the xla is there and is loaded and contains a sub 'mike()' that simply has a msgbox. thx "Chip Pearson" wrote in message ... Mike, Procedures of any sort, in an add-in or not, cannot change ANYTHING in the Excel environment when called directly or indirectly from a worksheet cell. If you just want to call a sub in the AddIn from other VBA code (not from a worksheet cell), use the Run method. E.g., Application.Run "MyAddIn.xla!MyMacro" -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "mike allen" wrote in message ... can i "call" a subroutine that is held in an add-in? all i know i can do pertains to functions (not sub's): i can type, in a cell on a spreadsheet, =myfuntion(a,b) and it will return c in that cell. i want the equivalent of hitting a user-created button that i created (forms, button icon, referencing a subroutine in the list). the only difference is my subroutine (not function) will be within an add-in, not within a module. is this possible? thanks -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calling Excel user defined function from C# | Excel Programming | |||
Calling user defined function from C/C++ | Excel Programming | |||
"User-defined type not defined" message in Excel | Excel Discussion (Misc queries) | |||
User-defined data type; Error: Only User-defined types... | Excel Programming | |||
Word.Document - user defined type not defined | Excel Programming |