PC Review


Reply
Thread Tools Rate Thread

Close Referenced Workbook if it's No Longer Referenced

 
 
Ryan H
Guest
Posts: n/a
 
      18th Mar 2010
Let me give you some background information first. I have a workbook (Quote
Generator v3.xls) that references an add-in workbook (QG Add-In v3.xla). The
Quote Generator v3 workbook is password protected thus opened as read only
and the sales team uses it to produce product quotes. When the user saves a
quote they have to rename the Quote Generator v3.xls workbook (because it is
read only). For example, user saves the quote as CompanyABC Quote.xls onto
the server. The sales person may have several quotes open that reference the
QG Add-In v3.xla workbook and they may have their own other workbooks open
that don't reference anything.

My question is this. If the sales person closes all the quote workbooks
that reference the add-in workbook the add-in workbook remains open, why?

If nothing is referencing the add in workbook shouldn't it close
automatically?

Is there a way to have the add-in workbook close when no other workbooks are
referencing it?

Thanks in Advance!
--
Cheers,
Ryan
 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      18th Mar 2010
The add-in will remain loaded even when there are not references to
it. Add-ins don't do any kind of reference count, such as does COM,
so until you unload the add-in either via the Add-Ins dialog or via
code, the add-in will remain loaded. The add-in itself has no
knowledge that it is (or is not) being referenced by some workbook.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Thu, 18 Mar 2010 08:10:08 -0700, Ryan H
<(E-Mail Removed)> wrote:

>Let me give you some background information first. I have a workbook (Quote
>Generator v3.xls) that references an add-in workbook (QG Add-In v3.xla). The
>Quote Generator v3 workbook is password protected thus opened as read only
>and the sales team uses it to produce product quotes. When the user saves a
>quote they have to rename the Quote Generator v3.xls workbook (because it is
>read only). For example, user saves the quote as CompanyABC Quote.xls onto
>the server. The sales person may have several quotes open that reference the
>QG Add-In v3.xla workbook and they may have their own other workbooks open
>that don't reference anything.
>
>My question is this. If the sales person closes all the quote workbooks
>that reference the add-in workbook the add-in workbook remains open, why?
>
>If nothing is referencing the add in workbook shouldn't it close
>automatically?
>
>Is there a way to have the add-in workbook close when no other workbooks are
>referencing it?
>
>Thanks in Advance!

 
Reply With Quote
 
Ryan H
Guest
Posts: n/a
 
      18th Mar 2010
Well since the add-in is considered "blind" to what workbooks are referencing
it, is there code that can count the workbooks that are currently referencing
the add-in? So if the count is 0 could I engineer so sort of code to close
the add-in? Hmmm

If this can't be done. Is there a way to make edits to the add-in workbook
(that is located on the server) while other workbooks are referencing it?

My problem is I update the add-in workbook when a user brings a bug to my
attention. If the user leaves the Excel application open and the add-in
workbook is not closed, Excel considers it as Read Only and I can't overwrite
the file. Is there a way to overwrite the .xla file when its being
referenced? Or do you have any other suggestions?

I basically have to depend on the sales team to close out Excel completely
in order to do any updates.

Thanks in advance,
--
Cheers,
Ryan


"Chip Pearson" wrote:

> The add-in will remain loaded even when there are not references to
> it. Add-ins don't do any kind of reference count, such as does COM,
> so until you unload the add-in either via the Add-Ins dialog or via
> code, the add-in will remain loaded. The add-in itself has no
> knowledge that it is (or is not) being referenced by some workbook.
>
> Cordially,
> Chip Pearson
> Microsoft Most Valuable Professional,
> Excel, 1998 - 2010
> Pearson Software Consulting, LLC
> www.cpearson.com
>
>
>
> On Thu, 18 Mar 2010 08:10:08 -0700, Ryan H
> <(E-Mail Removed)> wrote:
>
> >Let me give you some background information first. I have a workbook (Quote
> >Generator v3.xls) that references an add-in workbook (QG Add-In v3.xla). The
> >Quote Generator v3 workbook is password protected thus opened as read only
> >and the sales team uses it to produce product quotes. When the user saves a
> >quote they have to rename the Quote Generator v3.xls workbook (because it is
> >read only). For example, user saves the quote as CompanyABC Quote.xls onto
> >the server. The sales person may have several quotes open that reference the
> >QG Add-In v3.xla workbook and they may have their own other workbooks open
> >that don't reference anything.
> >
> >My question is this. If the sales person closes all the quote workbooks
> >that reference the add-in workbook the add-in workbook remains open, why?
> >
> >If nothing is referencing the add in workbook shouldn't it close
> >automatically?
> >
> >Is there a way to have the add-in workbook close when no other workbooks are
> >referencing it?
> >
> >Thanks in Advance!

> .
>

 
Reply With Quote
 
Neal Zimm
Guest
Posts: n/a
 
      18th Mar 2010
Hi Ryan,
I await Chip's answer too, 'cuz I'm going to have the same general
problem in an addin I'm developing.

What I do know from hands on experience, and this is a very generic
answer, is that some very big applications have to come down from time to
time for maintenance. (Like the authorization system @ American Express
where I used to work.)

My thoughts are, undeveloped as yet, is at a salesman's workbook open
event to check if the addin is open (and you would be the one to close it to
do your maint). If addin is closed, issue a msg "System will be backup in ??
minutes".

I am guessing at this, but to keep it closed you might have to rename the
addin while working on it, to keep if from being opened when a sales person
opens his/her workbook.

Neal

--
Neal Z


"Ryan H" wrote:

> Well since the add-in is considered "blind" to what workbooks are referencing
> it, is there code that can count the workbooks that are currently referencing
> the add-in? So if the count is 0 could I engineer so sort of code to close
> the add-in? Hmmm
>
> If this can't be done. Is there a way to make edits to the add-in workbook
> (that is located on the server) while other workbooks are referencing it?
>
> My problem is I update the add-in workbook when a user brings a bug to my
> attention. If the user leaves the Excel application open and the add-in
> workbook is not closed, Excel considers it as Read Only and I can't overwrite
> the file. Is there a way to overwrite the .xla file when its being
> referenced? Or do you have any other suggestions?
>
> I basically have to depend on the sales team to close out Excel completely
> in order to do any updates.
>
> Thanks in advance,
> --
> Cheers,
> Ryan
>
>
> "Chip Pearson" wrote:
>
> > The add-in will remain loaded even when there are not references to
> > it. Add-ins don't do any kind of reference count, such as does COM,
> > so until you unload the add-in either via the Add-Ins dialog or via
> > code, the add-in will remain loaded. The add-in itself has no
> > knowledge that it is (or is not) being referenced by some workbook.
> >
> > Cordially,
> > Chip Pearson
> > Microsoft Most Valuable Professional,
> > Excel, 1998 - 2010
> > Pearson Software Consulting, LLC
> > www.cpearson.com
> >
> >
> >
> > On Thu, 18 Mar 2010 08:10:08 -0700, Ryan H
> > <(E-Mail Removed)> wrote:
> >
> > >Let me give you some background information first. I have a workbook (Quote
> > >Generator v3.xls) that references an add-in workbook (QG Add-In v3.xla). The
> > >Quote Generator v3 workbook is password protected thus opened as read only
> > >and the sales team uses it to produce product quotes. When the user saves a
> > >quote they have to rename the Quote Generator v3.xls workbook (because it is
> > >read only). For example, user saves the quote as CompanyABC Quote.xls onto
> > >the server. The sales person may have several quotes open that reference the
> > >QG Add-In v3.xla workbook and they may have their own other workbooks open
> > >that don't reference anything.
> > >
> > >My question is this. If the sales person closes all the quote workbooks
> > >that reference the add-in workbook the add-in workbook remains open, why?
> > >
> > >If nothing is referencing the add in workbook shouldn't it close
> > >automatically?
> > >
> > >Is there a way to have the add-in workbook close when no other workbooks are
> > >referencing it?
> > >
> > >Thanks in Advance!

> > .
> >

 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      18th Mar 2010
I don't think that you can do what you want to do. Excel will not
allow you to close a workbook (or xla) when another workbook has a
reference to that workbook or xla. Excel does some sort of reference
counting internally, but there is no programmatic access to that.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Thu, 18 Mar 2010 10:07:01 -0700, Ryan H
<(E-Mail Removed)> wrote:

>Well since the add-in is considered "blind" to what workbooks are referencing
>it, is there code that can count the workbooks that are currently referencing
>the add-in? So if the count is 0 could I engineer so sort of code to close
>the add-in? Hmmm
>
>If this can't be done. Is there a way to make edits to the add-in workbook
>(that is located on the server) while other workbooks are referencing it?
>
>My problem is I update the add-in workbook when a user brings a bug to my
>attention. If the user leaves the Excel application open and the add-in
>workbook is not closed, Excel considers it as Read Only and I can't overwrite
>the file. Is there a way to overwrite the .xla file when its being
>referenced? Or do you have any other suggestions?
>
>I basically have to depend on the sales team to close out Excel completely
>in order to do any updates.
>
>Thanks in advance,

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Test If Add-In Workbook is being Referenced Ryan H Microsoft Excel Programming 4 14th Jul 2009 02:31 PM
Find Subs/Functions which are no longer referenced? Dennis Microsoft VB .NET 4 2nd May 2008 12:24 PM
Referenced Memory Error on Application Close =?Utf-8?B?VHlwaG9pZE1hcnR5?= Microsoft Dot NET 0 28th Mar 2007 09:16 PM
Workbook is being referenced =?Utf-8?B?c3BydWNpbw==?= Microsoft Excel Crashes 0 2nd Feb 2006 04:41 PM
Closing a referenced workbook Frederick Chow Microsoft Excel Programming 0 3rd Jan 2006 04:26 PM


Features
 

Advertising
 

Newsgroups
 


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