adamjones112182
New Member
- Joined
- Jan 30, 2020
- Messages
- 24
- Office Version
- 2016
- Platform
- Windows
Hi all,
I was wondering if I could get some help with this
I keep on getting Run-Time Error'1004':
Private Function GetValue(Path, File, Sheet, Ref)
' Retrieve a value from a closed workbook
Dim arg As String
' Make sure the file exists
If Right(Path, 1) <> "\" Then Path = Path & "\"
If Dir(Path & File) = "" Then
GetValue = "File Not Found"
Exit Function
End If
' Create the argument
arg = "" & Path & "[" & File & "]" & Sheet & "'!" & Range(Ref).Range("A1").Address(, , xlR1C1)
' Debug.Print arg
' Excute an XLM macro
GetValue = ExecuteExcel4Macro(arg) (Error occurs here)
End Function
I have run a debug, but I am still baffled
I was wondering if I could get some help with this
I keep on getting Run-Time Error'1004':
Private Function GetValue(Path, File, Sheet, Ref)
' Retrieve a value from a closed workbook
Dim arg As String
' Make sure the file exists
If Right(Path, 1) <> "\" Then Path = Path & "\"
If Dir(Path & File) = "" Then
GetValue = "File Not Found"
Exit Function
End If
' Create the argument
arg = "" & Path & "[" & File & "]" & Sheet & "'!" & Range(Ref).Range("A1").Address(, , xlR1C1)
' Debug.Print arg
' Excute an XLM macro
GetValue = ExecuteExcel4Macro(arg) (Error occurs here)
End Function
I have run a debug, but I am still baffled