Referencing an add-in in VBA

N

Nobody

We have an Excel 2002 worksheet that is using the Internet Assistant VBA
add-in. We make
a reference to this add-in in VBA and use this to save certain ranges of the
workbook as HTML
files.

The issue that pops up is if someone opens this workbook and they don't have
this add-in loaded
(i.e. the box is checked in the add-ins dialog box), they'll get a compile
error. We tried using
code to in VBA to install the add-in (Addins.Add...), but since the error
comes up when the
workbook is first loaded, this code doesn't get a chance to run (we have it
in the procedure that is
writing out the HTML).

Is there a way to do a type of late-binding to reference an add-in in Excel
2002?

Thanks
 
J

JW

In the Workbook_Open event, before anything else, you could check to
see if the AddIn is installed. I'm assuming that everyone using this
workbook has the add-in on their PC, but it might not be "installed"
in Excel. You could do something like this to ensure that it is
installed.
On Error Resume Next
If AddIns("AddInName.xla").Installed = False Then _
AddIns("AddInName.xla").Installed = True

If you need to actually add the add-in to Excel list of Add-Ins, you
could do something like:
AddIns.Add FileName:="C:\AddInFolder\AddInName.xla", _
CopyFile:=True

Or, you could modify your code to use the first code I gave to see if
the Add-In is installed wherever you need to. For example:
If AddIns("AddInName.xla").Installed <> False Then
Your Code Here
End If
 
N

Nobody

Thanks, I'll give it a try.

JW said:
In the Workbook_Open event, before anything else, you could check to
see if the AddIn is installed. I'm assuming that everyone using this
workbook has the add-in on their PC, but it might not be "installed"
in Excel. You could do something like this to ensure that it is
installed.
On Error Resume Next
If AddIns("AddInName.xla").Installed = False Then _
AddIns("AddInName.xla").Installed = True

If you need to actually add the add-in to Excel list of Add-Ins, you
could do something like:
AddIns.Add FileName:="C:\AddInFolder\AddInName.xla", _
CopyFile:=True

Or, you could modify your code to use the first code I gave to see if
the Add-In is installed wherever you need to. For example:
If AddIns("AddInName.xla").Installed <> False Then
Your Code Here
End If
 

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