Thread: check filename
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default check filename

Sorry you would use it like...

msgbox bookopen("MyBook.xls")
--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

Here is a simple function you can use. It is adapted from some code that I
got from Chip Pearson.

Public Function BookOpen(SName As String) As Boolean
On Error Resume Next
BookOpen = CBool(Len(Workbooks(SName).Name))
End Function

You would use it like this...

msgbox worbookopen("MyBook.xls")
--
HTH...

Jim Thomlinson


"Bill" wrote:

I have a macro that is opening and closing several workbooks for my Month
End reports. One of the workbooks treats and places data slightly differently
than all the other ones, and needs different formatting instructions for that
data.
I want to check if that specific filename is open. Is there a specific
command for that???

(I could create a flag that is on or off when the file is opened or closed,
and check that flag for true/false, but I wanted to know if there is a
command to do this)