![]() |
calling a user defined add-in
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 |
calling a user defined add-in
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 |
calling a user defined add-in
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 |
calling a user defined add-in
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 |
calling a user defined add-in
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 |
calling a user defined add-in
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 |
All times are GMT +1. The time now is 08:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com