ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to reference code located in an Add-in File (https://www.excelbanter.com/excel-programming/338673-how-reference-code-located-add-file.html)

keithb

How to reference code located in an Add-in File
 
What is the correct syntax for calling a VBA subroutine or function that
exists in a code module the resides in an Excel add-in file? Does the
calling syntax need to state the name of the code module where the called
code is located?

Thanks,

Keith




Tushar Mehta

How to reference code located in an Add-in File
 
In article ,
says...
What is the correct syntax for calling a VBA subroutine or function that
exists in a code module the resides in an Excel add-in file? Does the
calling syntax need to state the name of the code module where the called
code is located?

Thanks,

Keith




For a couple of examples see
How to use a class (object) from outside of the VBA project in which it
is declared
http://support.microsoft.com/default...b;en-us;555159

Don't worry about the class module stuff. Just focus on how the
function New_clsEmployee is called, especially the use of single quotes
in the file name.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

keithb

How to reference code located in an Add-in File
 
Thank you for answering. I read the article and it was helpful; however, I'm
still having a problem.
I have an add in named mapper.xla. I want to use the "'mapper.xla'!Sheet1"
Worksheet_Activate subroutine to run worksheet activation code for the
workbook that has the mapper.xla attachment. So far, nothing that I have
tried seems to work. Any suggestions?

Thanks,

Keith


"Tushar Mehta" wrote in message
om...
In article ,
says...
What is the correct syntax for calling a VBA subroutine or function that
exists in a code module the resides in an Excel add-in file? Does the
calling syntax need to state the name of the code module where the called
code is located?

Thanks,

Keith




For a couple of examples see
How to use a class (object) from outside of the VBA project in which it
is declared
http://support.microsoft.com/default...b;en-us;555159

Don't worry about the class module stuff. Just focus on how the
function New_clsEmployee is called, especially the use of single quotes
in the file name.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions




Tushar Mehta

How to reference code located in an Add-in File
 
You cannot access private event procedures in sheet modules in other
workbooks. If you wrote the add-in, consider making the code in the
event procedure part of a application level event procedure. For more
see XL VBA help for 'Using Events with the Application Object' (w/o the
quotes). It's a bit more work up front but the benefits more than make
up for it.

I never use worksheet or workbook level event procedures in any real
code I write. It's just bad form.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Thank you for answering. I read the article and it was helpful; however, I'm
still having a problem.
I have an add in named mapper.xla. I want to use the "'mapper.xla'!Sheet1"
Worksheet_Activate subroutine to run worksheet activation code for the
workbook that has the mapper.xla attachment. So far, nothing that I have
tried seems to work. Any suggestions?

Thanks,

Keith


"Tushar Mehta" wrote in message
om...
In article ,

says...
What is the correct syntax for calling a VBA subroutine or function that
exists in a code module the resides in an Excel add-in file? Does the
calling syntax need to state the name of the code module where the called
code is located?

Thanks,

Keith




For a couple of examples see
How to use a class (object) from outside of the VBA project in which it
is declared
http://support.microsoft.com/default...b;en-us;555159

Don't worry about the class module stuff. Just focus on how the
function New_clsEmployee is called, especially the use of single quotes
in the file name.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions





Tom Ogilvy

How to reference code located in an Add-in File
 
You can also see Chip Pearson's site for a page on application level events

http://www.cpearson.com/excel/appevent.htm



--
Regards,
Tom Ogilvy

"keithb" wrote in message
...
Thank you for answering. I read the article and it was helpful; however,

I'm
still having a problem.
I have an add in named mapper.xla. I want to use the "'mapper.xla'!Sheet1"
Worksheet_Activate subroutine to run worksheet activation code for the
workbook that has the mapper.xla attachment. So far, nothing that I have
tried seems to work. Any suggestions?

Thanks,

Keith


"Tushar Mehta" wrote in message
om...
In article ,
says...
What is the correct syntax for calling a VBA subroutine or function

that
exists in a code module the resides in an Excel add-in file? Does the
calling syntax need to state the name of the code module where the

called
code is located?

Thanks,

Keith




For a couple of examples see
How to use a class (object) from outside of the VBA project in which it
is declared
http://support.microsoft.com/default...b;en-us;555159

Don't worry about the class module stuff. Just focus on how the
function New_clsEmployee is called, especially the use of single quotes
in the file name.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions







All times are GMT +1. The time now is 05:42 PM.

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