ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use AddIn to Open an addtional Excel Workbook (https://www.excelbanter.com/excel-programming/395350-use-addin-open-addtional-excel-workbook.html)

John Cole, Jr.

Use AddIn to Open an addtional Excel Workbook
 
I have an Addin that I've written that contains the normal things.
However, there are references to worksheets that must be updated from
time to time. Rather than including these worksheets in the addin, I
have chose to include them in a separate workbook that contains only
those worksheets. I would like for the addin to open the workbook
automatically. Below is the Workbook_Open Code for the addin.

Private Sub Workbook_Open()
Call CreateMenu
'Open File
Dim moduleLineList As Object
Dim filePath As String
Dim fullPath As String
Dim fileNam As String
On Error Resume Next
fileNam = APPNAME & "TechData.xls"
filePath = Application.ThisWorkbook.Path
fullPath = filePath & "\" & fileNam
Set moduleLineList = GetObject(fullPath)

End Sub


This works fine on the .xls version of the addin, but whe I convert it
to an AddIn and install it, i get errors including the class name for
GetObject, etc.

Any Suggestions?


Bob Phillips

Use AddIn to Open an addtional Excel Workbook
 
Why not just do a workbooks.open?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"John Cole, Jr." wrote in message
oups.com...
I have an Addin that I've written that contains the normal things.
However, there are references to worksheets that must be updated from
time to time. Rather than including these worksheets in the addin, I
have chose to include them in a separate workbook that contains only
those worksheets. I would like for the addin to open the workbook
automatically. Below is the Workbook_Open Code for the addin.

Private Sub Workbook_Open()
Call CreateMenu
'Open File
Dim moduleLineList As Object
Dim filePath As String
Dim fullPath As String
Dim fileNam As String
On Error Resume Next
fileNam = APPNAME & "TechData.xls"
filePath = Application.ThisWorkbook.Path
fullPath = filePath & "\" & fileNam
Set moduleLineList = GetObject(fullPath)

End Sub


This works fine on the .xls version of the addin, but whe I convert it
to an AddIn and install it, i get errors including the class name for
GetObject, etc.

Any Suggestions?





All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com