sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,421
- Office Version
- 2016
- Platform
- Windows
I'm trying to get a procedure where a user browses for a file and check if it's open.
I've played around with this but it's giving me an error;
I'm getting 'ByRef argument type mismatch' and it highlights 'FileToOpen' on the following line;
Anyone know why this is happening?
I've played around with this but it's giving me an error;
Code:
FileToOpen = Application.GetOpenFilename(FileFilter:="Excel Files (*.xlsm), *.xlsm")
If FileToOpen = "False" Then
ActiveWorkbook.Close SaveChanges:=False
End If
FilePath = Left$(FileToOpen, InStrRev(FileToOpen, "\"))
FileName = Mid$(FileToOpen, InStrRev(FileToOpen, "\") + 1)
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim xRet As Boolean
xRet = IsWorkBookOpen(FileToOpen)
If xRet Then
MsgBox "The file is open", vbInformation, "Excel"
Else
MsgBox "The file is not open", vbInformation, "Excel"
End If
I'm getting 'ByRef argument type mismatch' and it highlights 'FileToOpen' on the following line;
Code:
xRet = IsWorkBookOpen(FileToOpen)
Anyone know why this is happening?