how to check if more than one excel file is open?
With no code posted it is hard to comment, so I will just be very general.
When I create custom toolbars for a specific workbook I create one function
to create the toolbar and another oen to delete the toolbar. On open or on
workbook activeate I make a call to create the toolbar. On close or on
workbook deactiveate I make a call to delete the toolbar.
As for the second question
Workbooks.Count
will give you a count of the open workbooks. Careful with this though as you
may have a personal workbook open (where you are storing macros). You will
need to test to see if Personal.xls is open...
--
HTH...
Jim Thomlinson
"Graff" wrote:
Hello,
I have two questions that hopefully someone might have answers to.
First, i have created a plug in for excel that i use only when a specific
file is opened. The plug in also creates a toolbar to run this code. Is it
possible to only show the toolbar when that specific file is opened? I tried
to do it from "This workbook" in workbook_open sub, but it just doesn't show
the toolbar at all. I test for opened file, but for some reason it always
shows that the file isn't opened.
Second, when i click Exit on my userform after running the code, it closes
this workbook that i'm working with. That's fine when there's more than one
excel file open, but if this file is the only one that's open, i'd like to
use something like Application.Quit to close the application. How can i check
to see if there is more than one excel file open?
Thanks for all your help.
IB
|