PC Review


Reply
Thread Tools Rate Thread

Calling a sub from a addin in vba

 
 
Roger
Guest
Posts: n/a
 
      2nd Nov 2003
I have created an addin from a sub() that I wrote in vba.

Now I want to create a button that runs the sub.

What must I put in the macro run box?

Addin name : addin
Project name : project
sub name : work()

Thanks
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      2nd Nov 2003
Roger,

Immediate way

Application.Run "Work"

Better way,

set a reference to the addin in Tools>References, and then just call it like
any other sub.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Roger" <(E-Mail Removed)> wrote in message
news:09e801c3a126$1d402c80$(E-Mail Removed)...
> I have created an addin from a sub() that I wrote in vba.
>
> Now I want to create a button that runs the sub.
>
> What must I put in the macro run box?
>
> Addin name : addin
> Project name : project
> sub name : work()
>
> Thanks



 
Reply With Quote
 
Roger
Guest
Posts: n/a
 
      2nd Nov 2003
Hmm

I want to make it so that the user can run the program at
any time, from any workbook. As they get a dump from
another program and this will sort it out into how they
want it.

Maybe I just misunderstood what you said.. could you
re-word it please then

Thanks

>-----Original Message-----
>Roger,
>
>Immediate way
>
>Application.Run "Work"
>
>Better way,
>
>set a reference to the addin in Tools>References, and then

just call it like
>any other sub.
>
>--
>
>HTH
>
>Bob Phillips
> ... looking out across Poole Harbour to the Purbecks
>(remove nothere from the email address if mailing direct)
>
>"Roger" <(E-Mail Removed)> wrote in message
>news:09e801c3a126$1d402c80$(E-Mail Removed)...
>> I have created an addin from a sub() that I wrote in

vba.
>>
>> Now I want to create a button that runs the sub.
>>
>> What must I put in the macro run box?
>>
>> Addin name : addin
>> Project name : project
>> sub name : work()
>>
>> Thanks

>
>
>.
>

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      2nd Nov 2003
Roger,

As it is an addin, you will need to install it on each machine that you want
to run from, agreed? I also assume that you don't want to set a reference to
the addin in each workbook, so the immediate way is best.

That being so, I assume you know how to create a button and add a macro call
from there. Let's assume that the button macro is called "RogersSub".

The code for "RogersSub" would look something akin to

Sub RogersSub()
Application.Run "Work"
End Sub

That should do it.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Roger" <(E-Mail Removed)> wrote in message
news:02e901c3a130$d3a2f480$(E-Mail Removed)...
> Hmm
>
> I want to make it so that the user can run the program at
> any time, from any workbook. As they get a dump from
> another program and this will sort it out into how they
> want it.
>
> Maybe I just misunderstood what you said.. could you
> re-word it please then
>
> Thanks
>
> >-----Original Message-----
> >Roger,
> >
> >Immediate way
> >
> >Application.Run "Work"
> >
> >Better way,
> >
> >set a reference to the addin in Tools>References, and then

> just call it like
> >any other sub.
> >
> >--
> >
> >HTH
> >
> >Bob Phillips
> > ... looking out across Poole Harbour to the Purbecks
> >(remove nothere from the email address if mailing direct)
> >
> >"Roger" <(E-Mail Removed)> wrote in message
> >news:09e801c3a126$1d402c80$(E-Mail Removed)...
> >> I have created an addin from a sub() that I wrote in

> vba.
> >>
> >> Now I want to create a button that runs the sub.
> >>
> >> What must I put in the macro run box?
> >>
> >> Addin name : addin
> >> Project name : project
> >> sub name : work()
> >>
> >> Thanks

> >
> >
> >.
> >



 
Reply With Quote
 
Kevin Beckham
Guest
Posts: n/a
 
      3rd Nov 2003
As an addendum to Bob's comment, you can reference the add-
in as follows

Application.Run "addin.xla!Work"

Kevin Beckham

>-----Original Message-----
>Roger,
>
>As it is an addin, you will need to install it on each

machine that you want
>to run from, agreed? I also assume that you don't want to

set a reference to
>the addin in each workbook, so the immediate way is best.
>
>That being so, I assume you know how to create a button

and add a macro call
>from there. Let's assume that the button macro is

called "RogersSub".
>
>The code for "RogersSub" would look something akin to
>
>Sub RogersSub()
> Application.Run "Work"
>End Sub
>
>That should do it.
>
>--
>
>HTH
>
>Bob Phillips
> ... looking out across Poole Harbour to the Purbecks
>(remove nothere from the email address if mailing direct)
>
>"Roger" <(E-Mail Removed)> wrote in message
>news:02e901c3a130$d3a2f480$(E-Mail Removed)...
>> Hmm
>>
>> I want to make it so that the user can run the program

at
>> any time, from any workbook. As they get a dump from
>> another program and this will sort it out into how they
>> want it.
>>
>> Maybe I just misunderstood what you said.. could you
>> re-word it please then
>>
>> Thanks
>>
>> >-----Original Message-----
>> >Roger,
>> >
>> >Immediate way
>> >
>> >Application.Run "Work"
>> >
>> >Better way,
>> >
>> >set a reference to the addin in Tools>References, and

then
>> just call it like
>> >any other sub.
>> >
>> >--
>> >
>> >HTH
>> >
>> >Bob Phillips
>> > ... looking out across Poole Harbour to the

Purbecks
>> >(remove nothere from the email address if mailing

direct)
>> >
>> >"Roger" <(E-Mail Removed)> wrote in message
>> >news:09e801c3a126$1d402c80$(E-Mail Removed)...
>> >> I have created an addin from a sub() that I wrote in

>> vba.
>> >>
>> >> Now I want to create a button that runs the sub.
>> >>
>> >> What must I put in the macro run box?
>> >>
>> >> Addin name : addin
>> >> Project name : project
>> >> sub name : work()
>> >>
>> >> Thanks
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling macro from a different addin =?Utf-8?B?TmF5YW4=?= Microsoft Excel Programming 2 3rd Aug 2007 08:50 PM
AddIn - Calling functions from VBA =?Utf-8?B?R3JhaGFtQg==?= Microsoft Excel Discussion 3 3rd Oct 2005 05:20 PM
Calling Addin function? Brian Shafer Microsoft Excel Discussion 2 6th Jan 2004 11:37 PM
Calling an Excel Addin from VBA ABN Microsoft Excel Programming 2 31st Jul 2003 02:33 PM
Calling an Excel Addin from VBA ABN Microsoft Excel Programming 0 31st Jul 2003 02:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:25 PM.