S
scott
I'm trying to load an add-in when my workbook opens. First I created an
add-in at "C:\data\test_addin.xla" that contains the code found below in
"CODE 2" section. Next, I added code found below in "CODE 1" section to the
file "C:\data\test.xls". While the add-in was open, in the Module property,
I named the module "test_AddIn".
If I open "C:\data\test.xls" containing "CODE 1", I get a "Subscript out of
range" error and trace the error to the line
If AddIns("test_AddIn").Installed = False
in "CODE 1". To further troubleshoot, I manually added the add-in within
Excel's References and noticed the name of my add-in within References is
called "VBAProject".
I asume, the error is being caused because of the "VBAProject" name of my
add-in.
QUESTIONS:
1. How can I change the "VBAProject" name to "test_AddIn".
2. Will changing the name as described in QUESTION #1 allow my add-in to
load when the "C:\data\test.xls" workbook opens?
3. If I'm going about this wrong, can someone shed some light on how to
accomplish this task?
' CODE 1: ****************************
Sub Aut
pen()
Dim tempStr As String
tempStr = "C:\data\test_addin.xla"
If Dir(tempStr) = "" Then
MsgBox "You do not have the Test Add-In installed."
End
End If
If AddIns("test_AddIn").Installed = False _
Then AddIns("test_AddIn").Installed = True
End Sub
Sub Auto_Close()
If AddIns("test_AddIn").Installed = True _
Then AddIns("test_AddIn").Installed = False
End Sub
' CODE 2: ****************************
Sub Aut
pen()
MsgBox "Add-In Loaded"
End Sub
add-in at "C:\data\test_addin.xla" that contains the code found below in
"CODE 2" section. Next, I added code found below in "CODE 1" section to the
file "C:\data\test.xls". While the add-in was open, in the Module property,
I named the module "test_AddIn".
If I open "C:\data\test.xls" containing "CODE 1", I get a "Subscript out of
range" error and trace the error to the line
If AddIns("test_AddIn").Installed = False
in "CODE 1". To further troubleshoot, I manually added the add-in within
Excel's References and noticed the name of my add-in within References is
called "VBAProject".
I asume, the error is being caused because of the "VBAProject" name of my
add-in.
QUESTIONS:
1. How can I change the "VBAProject" name to "test_AddIn".
2. Will changing the name as described in QUESTION #1 allow my add-in to
load when the "C:\data\test.xls" workbook opens?
3. If I'm going about this wrong, can someone shed some light on how to
accomplish this task?
' CODE 1: ****************************
Sub Aut
Dim tempStr As String
tempStr = "C:\data\test_addin.xla"
If Dir(tempStr) = "" Then
MsgBox "You do not have the Test Add-In installed."
End
End If
If AddIns("test_AddIn").Installed = False _
Then AddIns("test_AddIn").Installed = True
End Sub
Sub Auto_Close()
If AddIns("test_AddIn").Installed = True _
Then AddIns("test_AddIn").Installed = False
End Sub
' CODE 2: ****************************
Sub Aut
MsgBox "Add-In Loaded"
End Sub