LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Excel Add-in

This has been fixed. The problem was the file extension. Some code like
this, in the Workbook_Open event solves the problem:

If ThisWorkbook.IsAddin Then
g_sMyWbName = "example.xla"
Else
g_sMyWbName = "example.xls"
End If

then later...

Dim xwb as Excel.Workbook
Set xwb = Application.Workbooks(g_sMyWbName)

Thanks again...


"S. Daum" wrote in message
...
Thanks for all the replies. I am closer to a solution but not there yet.
In haste, the example I originally posted disguised/confused my real
problem. I am trying to get a reference to the "workbook" that IS my
"add-in." This workbook contains two "worksheets." Here is a more precise
code snippet:

Dim xwb as Excel.Workbook

Set xwb = Application.Workbooks("MyAddinWorkbook.xls")

The reply about an add-in having an .xla extension may be the answer? I am
in the process of trying this but I am temporarily "broken" for other
reasons.

As I mentioned this works when I have MyAddinWorkbook.xls open within

Excel
but fails when running as an add-in...

About the replay saying I could set ThisWorkbook.IsAddin = False - will

this
not then display my workbook as any other workbook? I would like to avoid
this if possible.

Thanks again for the replies.

Steve


"Harald Staff" wrote in message
...
A workbook is made up of many worksheets. So when you say that a

worksheet
is a workbook
then you ask for trouble.

--
HTH. Best wishes Harald
Excel MVP

Followup to newsgroup only please.

"S. Daum" wrote in message
...

Dim xs as Excel.Worksheet
Set xs = Application.Workbooks("MyCodeWorkBook.xls")









 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"