Hi Guy's, Here I have a function and a Sub to call the function, i am getting a message saying Sub Or Function Not Defined
I am checking if another user has got the excel file open or not, then open it if another user has not got it open
OR EVEN BETTER, HOW DO I SHARE THE FILE OVER A NETWORK ?, This maybe the better option ???
Function
Code:
Function IsXLOpen(FileName As String)Dim iFilenum As Long
Dim iErr As Long
On Error Resume Next
iFilenum = FreeFile()
Open FileName For Input Lock Read As #iFilenum
Close iFilenum
iErr = Err
On Error GoTo 0
Select Case iErr
Case 0: IsXLOpen = False
Case 70: IsXLOpen = True
Case Else: Error iErr
End Select
End Function
Sub
Code:
srcPath = "T:\DMT Ltd\XL Files\"
srcFile = "New Items.xlsx"
If Not IsXLOpen(srcPath & srcFile) Then Set xl = CreateObject("Excel.Application")
xl.Visible = True
xl.Workbooks.Open srcPath & srcFile, True, False
End If