Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following code tests whether a file is open on my computer and if
it isn't, it opens the file, and if it is already open, it tells me that. sub OpenMyFile() dim myPath as string dim myFile as string dim wkbk as Workbook myPath = "R:\share\ . . . Folder\" myFile = "SomeFileName.xlsm" set wlbk = Nothing On Error Resume Next set wkbk = Workbooks(myFile) On Error GoTo 0 If wkbk Is Nothing Then Set wkbk = Workbooks.Open(Filename:=myPath & myFile) Else MsgBox ("It's already open") End If End Sub The problem is that the file is on a network drive and others can open it. If someone else has it open, this routine will go ahead and open in on my computer as (Read Only). I would prefer that it not do that but instead give me the prompt that I would get if were to use to navigate to it and try to open it. In that case there would be a prompt telling who had it open and giving choices to open as Read Only or Notifiy or Cancel. Can code to that effect be added to this procedure? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro for Opening Reuters, Opening Excel File, Closing Excel File | Excel Programming | |||
opening a file in Excel starts application but dose not open file | Excel Discussion (Misc queries) | |||
Opening file in Excel 2003 opens multipule instances of same file | Excel Discussion (Misc queries) | |||
opening an excel file opens a duplicate file of the same file | Excel Discussion (Misc queries) | |||
Error:Invalid File format,while opening an Excel Template file | Excel Programming |