Here is one I use as part of a double_click event from a typed name in a
cell. It activates, if open or opens if not.
Sub GetWorkbook()
If ActiveCell.Value = "" Then Exit Sub
workbookname = ActiveCell.Value
On Error GoTo OpenWorkbook
Windows(workbookname & ".xls").Activate
Exit Sub
OpenWorkbook:
Workbooks.Open(workbookname & ".xls").RunAutoMacros xlAutoOpen
End Sub
'-----------------------------------------------------------------
Function IsWbOpen(FileName As String) As Boolean
'-----------------------------------------------------------------
On Error Resume Next
IsWbOpen = CBool(Len(Workbooks(FileName).Name))
End Function
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.