Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Test If Workbook is Open in Network and On Users Computer

I need a macro that currently tests if a workbook is open. The Archive
workbook is saved on our network server. The code below only works if the
workbook is open on the users computer. How can I test if anyone has the
workbook open in the network and the users computer?

Sub OpenFile()

' open archive workbook if not open or tell user to close it first
If IsWorkbookOpen(strArchiveName) Then
strPrompt = "The Archive workbook is already open. "
strPrompt = strPrompt & "Finish what you are doing, close it and try
again."
intButtons = vbCritical
strTitle = "Problem"
MsgBox strPrompt, intButtons, strTitle
Exit Sub
Else
With Application
.StatusBar = "Sending Items to the Archive...Please Wait"
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
Workbooks.Open Filename:=ThisWorkbook.Path & "\" & strArchiveName,
WriteResPassword:="AdTech"
End If

End Sub


Public Function IsWorkbookOpen(ByVal wbkName As String) As Boolean

SubName = "IsWorkbookOpen"

On Error Resume Next
IsWorkbookOpen = Not (Application.Workbooks(wbkName) Is Nothing)

End Function
--
Cheers,
Ryan
Reply
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
Prevent two network users from opening same workbook? Ed Excel Programming 2 May 9th 07 11:46 AM
Can I share a selfcert macro workbook with other network users KarenF Excel Discussion (Misc queries) 4 December 11th 06 11:22 PM
How to allow multiple users to update workbook (on network)? quddusaliquddus Excel Discussion (Misc queries) 0 June 29th 05 07:33 PM
auto update an open excel sheet over network, with mutiple users crumkerr Excel Worksheet Functions 1 November 29th 04 11:47 AM
Is workbook open anywhere in network? Miochael Bond Excel Programming 13 September 22nd 04 04:15 PM


All times are GMT +1. The time now is 11:56 PM.

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

About Us

"It's about Microsoft Excel"