Using a function from a vba add-in: is that considered an external link

B

Bura Tino

Hi,

If I use a function defined in a vba add-in, is that considered to be a link
to another workbook? If so, if I use the spreadsheet on another computer
with the add-in in another directory, how can I make excel look for this
function among currently installed add-ins rather than look for the same xla
workbook in the same location?

Thanks.

Bura
 
B

Bob Phillips

Bura,

If you have installed add-ins, set a reference to the add-in in the VBE
(Tools>Reference), and then you can use its functions as if it were local.

--

HTH

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

Bura Tino

Bob Phillips said:
Bura,

If you have installed add-ins, set a reference to the add-in in the VBE
(Tools>Reference), and then you can use its functions as if it were local.

I think you are talking about using the function in VBA. My question
pertains to using the function in the worksheet.

Bura
 
B

Bob Phillips

Bura,

You are correct, as you had posted to the programming group I did assume
that you were referring to the VBE.

If you mean worksheet, then you don't need a file identifier, you can call
it directly if it is installed.

--

HTH

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

Bura Tino

Bob Phillips said:
Bura,

You are correct, as you had posted to the programming group I did assume
that you were referring to the VBE.

If you mean worksheet, then you don't need a file identifier, you can call
it directly if it is installed.

And this is what doesn't work for me. If I call it directly if it is
installed it works for me. But if I send the workbook to a colleague and
they also have it installed (but perhaps in a different place), then all
references to the function become qualfied like so:

'C:\PathToWhereIKeepIt\MyAddin.xla'!MyFunction()

and it no longer works. This is a problem that I also described in a post
with a different subject line.

This has become a problem which rendered the add-in that I have been
developing for a month completely useless! I would be very happy if anyone
can help!

Bura
 
C

Charles Williams

Hi Bura,

Yes it is considered an external link.

Two solutions are:
- always install the addin in the same place (use an install package to make
sure)
- change links in the workbook (either manually or make your addin check
each workbook that is opened for links to itself and change them to itself)

You can download my auto-reversioning addinloader from my downloads page for
an example of how to automatically relink each workbook as it is opened.
(feel free to borrow or reuse any code as you want: the XLA password is dm).

Currently my addinloader still gives the message about the workbook
containing external links, but presumably you could also handle that
programmatically.


regards
Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com/FxlV2WhatsNew.htm
 
B

Bura Tino

Hi Charles,

My experience tells me that you are right - those are the only two
solutions. But it just seems to unreasonable!!!
This is not the case for add-ins written in C++. They talk about Excel
application, but how can you have an application which requires the user to
install it in a certain place? What if that place does not exists on the
user's machine? Besides, the "standard" place is different for different
users for the path includes the user's name.

What you are telling us seems true but is hard to believe!

Bewildered,

Bura
 
Top