Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Test to see if a workbook is open
I can't find anything in Help on this. When I open workbook "A" I want to
know if workbook "B" is already open because I'll do something in "A" as it opens if that is the case. The other thing I'd really like to know is if you can print from a workbook that is not open. Can anyone help please? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Test to see if a workbook is open
Reply (from a previouspostin) courtesy of Ron De Bruin:
You can use the workbook open event to run the code http://www.cpearson.com/excel/events.htm Then you can open the workbook like this If bIsBookOpen("test.xls") Then Set destWB = Workbooks("test.xls") Else Set destWB = Workbooks.Open("c:\test.xls") End If Copy this function in a normal module Function bIsBookOpen(ByRef szBookName As String) As Boolean ' Rob Bovey On Error Resume Next bIsBookOpen = Not (Application.Workbooks(szBookName) Is Nothing) End Function Re printing - I don't believe you can. "Brettjg" wrote: I can't find anything in Help on this. When I open workbook "A" I want to know if workbook "B" is already open because I'll do something in "A" as it opens if that is the case. The other thing I'd really like to know is if you can print from a workbook that is not open. Can anyone help please? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel 2003 saved file will not open without a blank workbook open | Excel Discussion (Misc queries) | |||
Need VB code for workbook open to open a link | Excel Discussion (Misc queries) | |||
Search open sheets in workbook and insert into open sheet | Excel Discussion (Misc queries) | |||
Excel workbook does not open in open window on desktop | Excel Discussion (Misc queries) | |||
Importing Data from unopened Workbook into an open Workbook | Excel Discussion (Misc queries) |