ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to call module function or sub from the Add In? (https://www.excelbanter.com/excel-programming/449846-how-call-module-function-sub-add.html)

Archidamos

How to call module function or sub from the Add In?
 
Hi all,
I have an Add In which is used by many worksheets.
In every worksheet module there is the starting sub 'Start'.
I created the icon in the Quick Access Toolbar and connected it to the macro located in Add In. From this macro I want to run the sub Start, which is in module belonging to currently opened worksheet.
In summary, the point is to use one icon to run the macro 'Start' in different worksheets.
But it's not working. Excel says 'Sub of Function not defined'.
It's there any way to run module macro from an Add In?
Thanks in advance.

Archidamos


Claus Busch

How to call module function or sub from the Add In?
 
Hi,

Am Fri, 21 Feb 2014 06:35:40 -0800 (PST) schrieb Archidamos:

I have an Add In which is used by many worksheets.
In every worksheet module there is the starting sub 'Start'.
I created the icon in the Quick Access Toolbar and connected it to the macro located in Add In. From this macro I want to run the sub Start, which is in module belonging to currently opened worksheet.
In summary, the point is to use one icon to run the macro 'Start' in different worksheets.


if you run a macro from a different workbook you have to write the
workbook name and the macro name like this:
Application.Run ("'" & ActiveWorkbook.Name & "'!Start")


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Archidamos

How to call module function or sub from the Add In?
 
W dniu piątek, 21 lutego 2014 15:59:04 UTC+1 użytkownik Claus Busch napisał:

Application.Run ("'" & ActiveWorkbook.Name & "'!Start")


Thank you very much Claus!

Regards
Archidamos

GS[_2_]

How to call module function or sub from the Add In?
 
Typically, addins create their own menus/toolbars at startup and remove
them at shutdown. This is particularly the case when the addin's
procedures are to be used with other workbooks.

In early versions of Excel addin menus are placed on the default
menubars and/or use their own toolbar. In 2007 and later these will
appear on the 'Addins' tab of the Ribbon.

So there's no need to use the QAT, and there's never a question as to
whether the macros associated with custom menus are available since
they're created when the addin opens and removed before it closes.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




All times are GMT +1. The time now is 08:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com