Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Word creates a small file whose name starts with a tilde mark to indicate when the file is open.
- 'Full path to the file to check, double up back slashes
- fileName = "Z:\\Chris\\~$Test.docx"
- 'Name of the computer to check
- strComputer = "."
- Set WshShell = CreateObject("WScript.Shell")
- Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
- Set colFiles = objWMIService.ExecQuery _
- ("Select * From CIM_Datafile Where Name = '"&fileName&"'")
- If colFiles.Count > 0 Then
- strMessage = "The file is open."
- Else
- strMessage = "The file is NOT open."
- End If
- intButton = WshShell.Popup (strMessage,30,"Safe to copy and edit?" , 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement