CarlRostron
Registered User.
- Local time
- Today, 06:10
- Joined
- Nov 14, 2011
- Messages
- 88
Having all kinds of prblems trying to get this to work.
 
I want to read a value of a cell from a closed workbook. I have since read that using the ExecuteExcel4Macro method is the best way to approach this (tell me if it isn't).
 
	
	
	
		
 
Please can you advise on this at all? I have had to put "R1C1" in the string as I couldn't get the Range object to work either.
 I want to read a value of a cell from a closed workbook. I have since read that using the ExecuteExcel4Macro method is the best way to approach this (tell me if it isn't).
		Code:
	
	
	  Dim ACPRanges As clACPRanges
  Dim arg As String
  Dim Sheet As String
  Dim GetValue As Variant
  Dim ref As String
  Dim theRange As Object
  Dim objExcel As Object
  
  Set ACPRanges = New clACPRanges
  Set objExcel = CreateObject("Excel.Application")
  objExcel.Visible = False
  
  
  For j = 1 To UBound(ACPFilepaths)
    Set f = fs.GetFile(ACPFilepaths(j))
    'sheetName = 1110014_2012_10_25_Task 02 - AC
    Sheet = Left(f.Name, 31)
    ref = ACPRanges.flowPlannedStartDate
    'Set theRange = objExcel.Range(ref).Address(
    'MsgBox Range(ref).Address(True, True, xlR1C1)
    
    [B]'THIS IS WHERE THE CODE FAILS[/B]
    arg = "'" & f.ParentFolder & "\" & "[" & f.Name & "]" & _
          Sheet & "'!" & "R1C1"
    MsgBox (arg)
 
    GetValue = ExecuteExcel4Macro(arg)Please can you advise on this at all? I have had to put "R1C1" in the string as I couldn't get the Range object to work either.
 
	 
 
		
 
 
		 
 
		 
 
		