Jaafar Tribak
Well-known Member
- Joined
- Dec 5, 2002
- Messages
- 9,779
- Office Version
- 2016
- Platform
- Windows
Hi all,
I am not experienced with network programming so I am asking here if the following prank would work (this is just an illustrative example)
Ok- Let's say a remote workbook (located in a network shared Drive/Folder) is currently opened by some user on the network and I wanted to play a prank on them by undoing their worksheet data input as follows :
Code in my workbook module: (Obviously, C:\RemoteWb.xls would need to be modified to the server path)
I tried the above code on a second excel instance on my computer and it worked as expected but would this also work if the shared network workbook was opened remotely by someone on the network ?
Another question: Is there a way of knowing if a workbook or application is currently being referenced by another program ?
Regards
I am not experienced with network programming so I am asking here if the following prank would work (this is just an illustrative example)
Ok- Let's say a remote workbook (located in a network shared Drive/Folder) is currently opened by some user on the network and I wanted to play a prank on them by undoing their worksheet data input as follows :
Code in my workbook module: (Obviously, C:\RemoteWb.xls would need to be modified to the server path)
Code:
Private WithEvents Xlapp As Application
Sub HookRemoteWorkbook()
Set Xlapp = GetObject("C:\RemoteWb.xls").Application [COLOR=#008000]'change to server pathname[/COLOR]
End Sub
Private Sub Xlapp_SheetChange(ByVal Sh As Object, ByVal Target As Range)
With Sh.Application
.EnableEvents = False
.Undo
Target = "Go to hell !!"
.EnableEvents = True
End With
End Sub
I tried the above code on a second excel instance on my computer and it worked as expected but would this also work if the shared network workbook was opened remotely by someone on the network ?
Another question: Is there a way of knowing if a workbook or application is currently being referenced by another program ?
Regards