Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default 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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default 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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Excel user defined function from C# Stanley Excel Programming 0 June 26th 06 02:16 PM
Calling user defined function from C/C++ Ravil Excel Programming 0 April 24th 06 06:05 PM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
Word.Document - user defined type not defined jowatkins[_7_] Excel Programming 0 January 20th 04 08:46 AM


All times are GMT +1. The time now is 03:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"