LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 23
Default Checking if a workbook is open

Hi.
I have this bit of code that is meant to check if a certain workbook is 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 on 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\Holding folder\Todays Dissolution requests.xls"
IsOpen = BookOpen(Bookname)
If IsOpen Then
MsgBox "The Dissolution Tool is curently in use. Please try again in a few minutes"
Else

End If


End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking if another workbook is open Vijay Kotian Excel Programming 1 November 15th 06 03:00 PM
Checking if another workbook is open bigpalooka Excel Programming 0 November 14th 06 05:04 PM
Checking if Workbook is Open MMesarch Excel Programming 4 November 8th 05 03:11 PM
Checking for open workbook... Squid[_2_] Excel Programming 7 February 28th 04 01:16 AM
Checking for Open Workbook sbharbour Excel Programming 6 August 28th 03 11:42 PM


All times are GMT +1. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"