I have this code that opens up a file that I click on. Works great except when someone is already in file. How can I stop my code from erroring out if someone is in the file.
Code:
ChDrive "E:\"
ChDir "E:\2007 Work\Analytical Review\Operating Expenses"
TheFile2 = Application.GetOpenFilename("Excel Files (*.xls), *.xls", , "Open Current Month Operating Expense Review File")
If TheFile2 = "False" Then
OpenA.Activate
ActiveWindow.Close
Exit Sub
End If
Workbooks.Open Filename:=TheFile2
Set OpenB = Workbooks(Workbooks.Count)