View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default If Then to check if a workbook is open

On Error Resume Next
Set oWB = Workbooks("Moon.txt")
On Error Goto 0
If Not oWB Is Nothing Then
'do the stuff
End If

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Shawn" wrote in message
...
I have a workbook names "Space.xls" and when a certain macro is run it

goes
and pulls date from a workbook named "Moon.txt". This all works fine.

However, I need a code that will look to see if "Moon.txt" is open and if

it
is not to skip that part of the code.






--
Thanks
Shawn