Call Subx for excel 97 Add-In subroutine

B

Bob Phillips

Set a reference to the addin in the VBE, Tools>References.

Before doing so, it is probably a good idea to give the project a meaningful
name in the VBE.

--

HTH

RP
(remove nothere from the email address if mailing direct)


Dave D-C said:
I've looked at the web sites re add-ins and excel 97 but I must be
missing something. To call a subroutine in the add-in, I still
have to use Application.Run.

My Add-in is Addin1.xla.
It is checked in the Tools/Addins dialog.
It loads when I start excel (I see
VBAProject(Addin1.xla) in the ProjectExplorer).
ThisWorkBook/IsAddin is True.
The sheets are hidden/invisible.
Subroutine ASub1 is in Module1:
Public Sub ASub1()
msgbox "ASub1"
End Sub

On a new workbook, in Module1:
Application.Run "Addin1!asub1" ' works
Application.Run "asub1" ' works
call asub1 ' gives 'Sub or Function not defined'

Isn't this supposed to work for an Add-In?

TIA, Dave
=----
 
T

Tom Ogilvy

You have to use application.run unless you create a reference to the addin
from the workbook where you want to run it.

--
Regards,
Tom Ogilvy


Dave D-C said:
I've looked at the web sites re add-ins and excel 97 but I must be
missing something. To call a subroutine in the add-in, I still
have to use Application.Run.

My Add-in is Addin1.xla.
It is checked in the Tools/Addins dialog.
It loads when I start excel (I see
VBAProject(Addin1.xla) in the ProjectExplorer).
ThisWorkBook/IsAddin is True.
The sheets are hidden/invisible.
Subroutine ASub1 is in Module1:
Public Sub ASub1()
msgbox "ASub1"
End Sub

On a new workbook, in Module1:
Application.Run "Addin1!asub1" ' works
Application.Run "asub1" ' works
call asub1 ' gives 'Sub or Function not defined'

Isn't this supposed to work for an Add-In?

TIA, Dave
=----
 
D

Dave D-C

I've looked at the web sites re add-ins and excel 97 but I must be
missing something. To call a subroutine in the add-in, I still
have to use Application.Run.

My Add-in is Addin1.xla.
It is checked in the Tools/Addins dialog.
It loads when I start excel (I see
VBAProject(Addin1.xla) in the ProjectExplorer).
ThisWorkBook/IsAddin is True.
The sheets are hidden/invisible.
Subroutine ASub1 is in Module1:
Public Sub ASub1()
msgbox "ASub1"
End Sub

On a new workbook, in Module1:
Application.Run "Addin1!asub1" ' works
Application.Run "asub1" ' works
call asub1 ' gives 'Sub or Function not defined'

Isn't this supposed to work for an Add-In?

TIA, Dave
 
D

Dave Peterson

You don't HAVE to respond with a thankyou, but lots of people like to see it.

That way, they know that you have an answer (and they didn't waste their time
providing an answer that may not have been read). And it gives feedback that
the suggested solution worked.

(If I respond with a suggestion that doesn't even come close to working, then
your response may stop me from using it for a similar question by different
poster.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top