i am trying to make a script that would be run every 5 minutes by windows task scheduler, the script is pretty much done, but with one flaw. Script runs the macro inside a exel file on local server storage but i dont know how to check if someonne has the file opened? it should be really simple actually, if file is already opened then skip code. that way the script wont bother annyone that is at the moment working on the file.
here is my script:
Option Explicit
On Error Resume Next
Test
Sub Test()
Dim XL
Dim WBK
Set XL = CreateObject("Excel.Application")
Set WBK = XL.Workbooks.Open("C:\Users\Mobilefreek\Desktop\MFT_Vnosi_Test.xlsm")
XL.Run "MFT_Izracun"
WBK.Save
WBK.Close
Set WBK = Nothing
Set XL = Nothing
End Sub