Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to create separate instance of Add-in for new Workbook?

Thanks, Mike.
I'll try out what you've said and see if that solves my problem.
Shankar


Mike Woodhouse wrote:
On Nov 14, 7:11 am, wrote:
Hi,

VBA version: 6.0.
OS: Win 2000

I have an Add-in which uses XML. The add-in has different user forms to
manipulate the XML data. Assume I have just one Workbook open (WB_1).
Now when I create a new Workbook (WB_2), WB_2 uses the SAME instance of
the add-in.


That looks about right.

That means if I make some changes in a user form in WB_1's Add-in,
these changes are reflected in the same user form opened from WB_2's
Add-in.


Correct.

1. Why is there a same copy of the Add-in for both Workbooks??


Because Add-ins apply to the instance of Excel, not to Workbooks. I
imagine this is by design.

2. How can I prevent this from happening? I would like WB_1 and WB_2 to
have their own respective copies of my add-in.


Move all the workbook-specific data into a class (representing the
"state"), then maintain a separate instance of the class for each
workbook as necessary. I would look at keeping a Collection of such
objects, keyed by Workbook.Name, so the add-in can ask for the correct
state object for the workbook.


(Instead of creating WB_2, had I opened a new instance of Excel itself,
there's no such problem. WB_1 in the first instance of Excel is totally
independent of the workbook in the second instance of Excel.)


Well, yes. Each instance of Excel has its own process space into which
the add-in has loaded.

HTH,

Mike


Reply
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create 2 separate tabs in my workbook? Valerie Excel Discussion (Misc queries) 5 July 20th 09 05:31 PM
Separate Window/Instance Per Excel File Gemini Excel Discussion (Misc queries) 1 April 2nd 08 01:48 PM
open excel in a separate instance Eric Excel Discussion (Misc queries) 0 March 9th 07 08:01 PM
how to re-set excel2000 to open a second instance in a separate wi TorontoJames Excel Discussion (Misc queries) 4 December 12th 05 03:52 PM


All times are GMT +1. The time now is 02:53 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"