NessPJ
Active Member
- Joined
- May 10, 2011
- Messages
- 420
- Office Version
- 365
Hello All,
Only recently i've found out its actually possible to find a value from a file without going through the seperate hassle of opening it etc.
I found the following code to do this:
I tried modifying the code to work the way i would want it to (i refer to some cells in my sheet, rather then having the path hardcoded entirely....this gives a poweruser some more control for the future).
I verified the path that is created this way a couple of times and it seems to be 100% correct.
The only difference is, i would like to address the actual Cell number rather then using the R1C1 method. Is this possible this way?
Thanks in advance for any help!
Only recently i've found out its actually possible to find a value from a file without going through the seperate hassle of opening it etc.
I found the following code to do this:
Rich (BB code):
Sub ReadClosed()
'
' Credit this To Bob Umlas
'
Dim strPath As String
Dim strFile As String
Dim strInfoCell As String
strPath = Sheets("Parameters").Range("F14").Value
strFile = Sheets("Parameters").Range("F15").Value
strInfoCell = "'" & strPath & "[" & strFile & "]Sheet1'!R2C1"
MsgBox "In Cell A2 = " & ExecuteExcel4Macro(strInfoCell), vbInformation, strFile
End Sub
I tried modifying the code to work the way i would want it to (i refer to some cells in my sheet, rather then having the path hardcoded entirely....this gives a poweruser some more control for the future).
Rich (BB code):
Sub ReadOnly2()
'
' Credit this To Bob Umlas
'
Dim strPath As String
Dim strFile As String
Dim strSheet As String
Dim strInfoCell As String
strPath = Sheets("Parameters").Range("F14").Value
strFile = Sheets("Parameters").Range("F15").Value
strSheet = Sheets("Parameters").Range("F16").Value
strInfoCell = "'" & strPath & "[" & strFile & "]" & strSheet & "'!M990"
MsgBox "In Cell M990 = " & ExecuteExcel4Macro(strInfoCell), vbInformation, strFile
End Sub
I verified the path that is created this way a couple of times and it seems to be 100% correct.
The only difference is, i would like to address the actual Cell number rather then using the R1C1 method. Is this possible this way?
Thanks in advance for any help!