Is workbook open?
Posted by Ben on April 20, 2001 10:48 AM
I have tried to write a macro that If Workbook1 isnt open it will open it and then close it. But if it is open it wont open it again and it wont be closed. But I cannpt get it to work. Can anyone please tell me how to change the code to get it to do this?
Sub Workbook1()
Dim Workbook1Open As String
Workbook1Open = False
If Workbooks("Workbook 1.xls") = Active Then
Workbook1 = True
End If
If Workbook1 = False Then
Workbooks.Open ThisWorkbook.Path & "\Workbook 1.xls"
End If
MORE CODE GOES HERE!!!
If Workbook1 = True Then
Workbooks.Close "Workbook 1.xls"
End If
End Sub
Thanks