View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Eric Eric is offline
external usenet poster
 
Posts: 1,670
Default How to code macro with condition?

Is there any code to check whether the file is opened or not?
Thanks in advance for any suggestions
Eric

"JLGWhiz" wrote:

fName = "SomeFile.xls" '<<< The file you want to check
For Each wb In Application.Workbooks
If wb.Name = fName Then
Exit Sub
Else
"Run the code
End If
Next



"Eric" wrote in message
...
If specific file is currently opened, then not processing following
coding,
else process them.
Does anyone have any suggestions on how to code it in macro?
Thanks in advance for any suggestions
Eric

Sub RunOrNot

'Is specific file opened? if not, then process following coding
Coding
'End If

End Sub



.