Sub ActivateWorkbook2()
Dim sPath As String
Dim sFileName As String
Dim sFullName As String
Dim myWorkbook As Workbook
sFileName = "SalesData1.xlsx"
If bIsWorkbookOpen(sFileName) Then
Set myWorkbook = Workbooks(sFileName)
myWorkbook.Activate
Else
sPath = ThisWorkbook.Path
sFullName = sPath & "\" & sFileName
Set myWorkbook = Workbooks.Open(FileName:=sFullName)
End If
End Sub
|