PC Review


Reply
Thread Tools Rate Thread

Calling function from non-referenced add-in

 
 
erstewart00@charter.net
Guest
Posts: n/a
 
      14th Feb 2008
Hello,

I've tried researching this topic but it is still not clear to me what
the correct syntax is, or if this is even possible.

Inside one sub, I would like to call a function in an add-in, but want
it to work if the add-in is not necessarily referenced in the project.

Ex.

str = fct_name( arg1, arg2)

This works if I reference the add-in.

str = (?)fct_name(arg1, arg2)

Isn't there a way to fully qualify this (?) such that the add-in does
not need to be specifically referenced?

Thanks for any input.
Eric
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      14th Feb 2008
s = Application.Run("myAddin.xla!fct_name", arg1, arg2)

Inclusion of the addin name may not be necessary if there's no ambiguity of
the procedure name in any open project.

Regards,
Peter T

<(E-Mail Removed)> wrote in message
news:622a6fb1-a4ec-4a79-bc2e-(E-Mail Removed)...
> Hello,
>
> I've tried researching this topic but it is still not clear to me what
> the correct syntax is, or if this is even possible.
>
> Inside one sub, I would like to call a function in an add-in, but want
> it to work if the add-in is not necessarily referenced in the project.
>
> Ex.
>
> str = fct_name( arg1, arg2)
>
> This works if I reference the add-in.
>
> str = (?)fct_name(arg1, arg2)
>
> Isn't there a way to fully qualify this (?) such that the add-in does
> not need to be specifically referenced?
>
> Thanks for any input.
> Eric



 
Reply With Quote
 
erstewart00@charter.net
Guest
Posts: n/a
 
      15th Feb 2008
On Feb 14, 5:48*pm, "Peter T" <peter_t@discussions> wrote:
> s = Application.Run("myAddin.xla!fct_name", arg1, arg2)
>
> Inclusion of the addin name may not be necessary if there's no ambiguity of
> the procedure name in any open project.
>
> Regards,
> Peter T
>
> <erstewar...@charter.net> wrote in message
>
> news:622a6fb1-a4ec-4a79-bc2e-(E-Mail Removed)...
>
>
>
> > Hello,

>
> > I've tried researching this topic but it is still not clear to me what
> > the correct syntax is, or if this is even possible.

>
> > Inside one sub, I would like to call a function in an add-in, but want
> > it to work if the add-in is not necessarily referenced in the project.

>
> > Ex.

>
> > str = fct_name( arg1, arg2)

>
> > This works if I reference the add-in.

>
> > str = (?)fct_name(arg1, arg2)

>
> > Isn't there a way to fully qualify this (?) such that the add-in does
> > not need to be specifically referenced?

>
> > Thanks for any input.
> > Eric- Hide quoted text -

>
> - Show quoted text -


Thanks. This worked for me. Just curiuos how the syntax would change
if there was ambiguity and I had to specify the module as well?
 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      15th Feb 2008
<(E-Mail Removed)> wrote in message
On Feb 14, 5:48 pm, "Peter T" <peter_t@discussions> wrote:

> > > Inside one sub, I would like to call a function in an add-in, but want
> > > it to work if the add-in is not necessarily referenced in the project.

> >
> > s = Application.Run("myAddin.xla!fct_name", arg1, arg2)
> >
> > Inclusion of the addin name may not be necessary if there's no
> > ambiguity of the procedure name in any open project.

>
> Regards,
> Peter T
>
> Thanks. This worked for me. Just curiuos how the syntax would
> change if there was ambiguity and I had to specify the module as well?


Normally there shouldn't, couldn't, be any ambiguity of procedure names
within the same project. However you can qualify the procedure name with the
module name and a dot, eg

s = Application.Run("'myAddin.xla'!modName.fct_name", arg1, arg2)

Notice I've also embraced the wb name with apostrophes, necessary if certain
characters are present in the wb name, such as a space.

If you want to go the whole hog you could also include the path to ensure
the addin opens if not already
s = Application.Run("'c:\path\myAddin.xla'!.fct_name", arg1, arg2)

Obviously you'd need to know the path though you wouldn't necessarily need
to hard code it, as above.

Regards,
Peter T


Regards,
Peter T


 
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
C# calling C++ dll (Instruction at referenced memory could not be read) gwell Microsoft C# .NET 6 10th Aug 2007 08:32 AM
Keep function result after removing referenced column =?Utf-8?B?Q2hhcmxlcyBpbiBJcmFx?= Microsoft Excel Worksheet Functions 3 16th Nov 2006 12:31 PM
Calling EXE Function Getting handle to calling exe Abhishek Microsoft VC .NET 1 25th Sep 2006 01:58 PM
Calling managed function from unmanaged function in mixed mode dll slugster@gmail.com Microsoft VC .NET 1 25th Jul 2005 07:30 AM
Calling DoCmd.RunCommand acCmdSaveRecord, after calling an API function Savvoulidis Iordanis Microsoft Access Form Coding 2 19th Mar 2005 06:34 PM


Features
 

Advertising
 

Newsgroups
 


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