Values from a closed workbook
How to read values from a closed workbook ?
Private Function GetInfoFromClosedFile(ByVal sFolderPath As String, _
ByVal sWbkName As String, _
ByVal sWshName As String, _
ByVal sCellRange As String) As Variant
Dim sargument As String
GetInfoFromClosedFile = ""
If Right(sFolderPath, 1) <> "\" Then sFolderPath = sFolderPath & "\"
If Dir(sFolderPath & "\" & sWbkName) = "" Then
Call MsgBox("File not found.")
Exit Function
End If
sargument = "'" & sFolderPath & "[" & sWbkName & "]" & sWshName & "'!" & Range(sCellRange).Address(True, True, xlR1C1)
On Error Resume Next
GetInfoFromClosedFile = ExecuteExcel4Macro(sargument)
End Function
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext