Thread: Workbook Open?
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Workbook Open?

If the file is already open, you only need the file name.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"GrantW" wrote in message
...
Hi Jim,
You answered this ages ago, I know, but how could I adapt your code to
look
for the file in our main server. Would I include the filepath as:

set wbk = workbooks("\\servername\serversubdirectory\MyBook. xlsx") ?

Oh... and thanks :)


"Jim Thomlinson" wrote:

My prefered method...This one opens the book if it is not open...

dim wbk as workbook

on error resume next
set wbk = workbooks("MyBook.xls")
on error goto 0

if wbk is nothing then
msgbox "Opening the book now"
set wbk = workbooks.Open("C:\MyBook.xls")
end if
--
HTH...

Jim Thomlinson


"ArthurJ" wrote:

How can I test to see if a particular workbook is open?

Thanks,
Art