Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem accessing Sub routines in Addin modules

Hi all:

I'm having a lot of trouble accessing Sub routines in an Addin from a
worksheet. For some reason, I can access the any Functions just fine like so:

=AddinFunctionName()

But, I cannot access similar Subs with what I thought was the correct syntax:

AddinSubName

When I try the latter, I get a compiler error.

ANY help will be greatly appreciated!

Thanks!

Jon

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem accessing Sub routines in Addin modules

Hi Peter:

Thanks for the info. Could you explain a bit more about creating a
reference to the Addin via a Tools reference? Is this different than
installing and enabling the Addin? The Excel 2007 Help system isn't exactly
a user-friendly platform.

Thanks again!

Jon

UDF's in an addin can be used in cell formulas as you describe.

However, if you want code in your project to call a procedure in an addin
there are two ways

1. Set a reference in your project to the addin project via Tools

references

2. result = Application.Run("myAddin.xla!myFunc", arg1)
or call Application.Run("myAddin.xla!mySub", arg1)

Regards,
Peter T

Hi all:

I'm having a lot of trouble accessing Sub routines in an Addin from a
worksheet. For some reason, I can access the any Functions just fine

like
so:

=AddinFunctionName()

But, I cannot access similar Subs with what I thought was the correct
syntax:

AddinSubName

When I try the latter, I get a compiler error.

ANY help will be greatly appreciated!

Thanks!

Jon



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Problem accessing Sub routines in Addin modules

UDF's in an addin can be used in cell formulas as you describe.

However, if you want code in your project to call a procedure in an addin
there are two ways

1. Set a reference in your project to the addin project via Tools references

2. result = Application.Run("myAddin.xla!myFunc", arg1)
or call Application.Run("myAddin.xla!mySub", arg1)

Regards,
Peter T

"JonWestcot" wrote in message
...
Hi all:

I'm having a lot of trouble accessing Sub routines in an Addin from a
worksheet. For some reason, I can access the any Functions just fine like
so:

=AddinFunctionName()

But, I cannot access similar Subs with what I thought was the correct
syntax:

AddinSubName

When I try the latter, I get a compiler error.

ANY help will be greatly appreciated!

Thanks!

Jon



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Problem accessing Sub routines in Addin modules

In the VBE, under Tools, click References -

Find the project name of your addin, select and tick. Hopefully the addin's
project name has been renamed from the default "VBAProject" to something
unique (if not and it's your addin I suggest you do that).

After setting the reference you can refer to anything in the addin as if it
were in your own. Ensure there are no similarly named procedures in
respective projects.

Note there are issues to consider if your workbook is to be distributed to
other users who do not have the addin in the exact same path.

Setting this reference is not related whether the addin is installed into
the addin manager. If the addin is not already loaded, as it normally would
be if installed, it will load automatically as soon as it's required
(subject of course to it being in the same location as it was when the
reference was added).

Regards,
Peter T


"jon.westcot" wrote in message
...
Hi Peter:

Thanks for the info. Could you explain a bit more about creating a
reference to the Addin via a Tools reference? Is this different than
installing and enabling the Addin? The Excel 2007 Help system isn't
exactly
a user-friendly platform.

Thanks again!

Jon

UDF's in an addin can be used in cell formulas as you describe.

However, if you want code in your project to call a procedure in an addin
there are two ways

1. Set a reference in your project to the addin project via Tools

references

2. result = Application.Run("myAddin.xla!myFunc", arg1)
or call Application.Run("myAddin.xla!mySub", arg1)

Regards,
Peter T

Hi all:

I'm having a lot of trouble accessing Sub routines in an Addin from a
worksheet. For some reason, I can access the any Functions just fine

like
so:

=AddinFunctionName()

But, I cannot access similar Subs with what I thought was the correct
syntax:

AddinSubName

When I try the latter, I get a compiler error.

ANY help will be greatly appreciated!

Thanks!

Jon





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
Accessing Public variable in different modules Denis[_4_] Excel Programming 6 May 18th 07 12:14 PM
Question about accessing worksheets on an AddIn file 39N95W Excel Programming 1 May 25th 04 03:11 AM
Accessing Addin from Sheet_Event Code zSplash Excel Programming 3 December 7th 03 09:52 PM
Accessing Addin from Sheet_Event Code zSplash Excel Programming 0 December 7th 03 05:35 PM
Accessing AddIn Class Modules from Client Worksheet Mark D'Agosta Excel Programming 0 October 9th 03 04:43 PM


All times are GMT +1. The time now is 12: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"