K
kardifflad
Hi.
I have this bit of code that is meant to check if a certain workbook i
open and if it is its meant to tell the user to try again later
Unortunately it doesn't. It just skips the msgbox and carries o
regardless.
can anyone se the problem with the code please?
Function BookOpen(Bk As String) As Boolean
Dim T As Excel.Workbook
Err.clear
On Error Resume Next
Set T = Application.Workbooks(Bk)
BookOpen = Not T Is Nothing
Err.clear
On Error GoTo 0
End Function
Sub OpenAWorkbook()
Dim IsOpen As Boolean
Dim Bookname As String
Bookname = "\\Irf00743\lc ccg ctops bdap\Dissolutions\Holdin
folder\Todays Dissolution requests.xls"
IsOpen = BookOpen(Bookname)
If IsOpen Then
MsgBox "The Dissolution Tool is curently in use. Please try again i
a few minutes"
Else
End If
End Su
I have this bit of code that is meant to check if a certain workbook i
open and if it is its meant to tell the user to try again later
Unortunately it doesn't. It just skips the msgbox and carries o
regardless.
can anyone se the problem with the code please?
Function BookOpen(Bk As String) As Boolean
Dim T As Excel.Workbook
Err.clear
On Error Resume Next
Set T = Application.Workbooks(Bk)
BookOpen = Not T Is Nothing
Err.clear
On Error GoTo 0
End Function
Sub OpenAWorkbook()
Dim IsOpen As Boolean
Dim Bookname As String
Bookname = "\\Irf00743\lc ccg ctops bdap\Dissolutions\Holdin
folder\Todays Dissolution requests.xls"
IsOpen = BookOpen(Bookname)
If IsOpen Then
MsgBox "The Dissolution Tool is curently in use. Please try again i
a few minutes"
Else
End If
End Su