VBA Question
I don't know what else to say
Are the paths in A1:A3 in double quotes?
"C:\the path\more path\rest of path"
Does the workbook ORF.xlsx exist in each of the tree folders?
I cannot replicate the "explorer window" unless one or both of the above
criteria are not met.
Gord
On Thu, 30 Jun 2011 08:48:22 -0700 (PDT), carl wrote:
Thanks Gord.
I made the changes but the macro still prompts me with the explorer
window to select a file.
I have my list of paths in Sheet 1 A1:A3
Here's the code I am using.
Sub test2()
Dim nRow As Integer, nColumn As Integer, n As Integer
Dim sDir As String
nRow = 5
For i = 1 To 3 'where 3 is the range of paths in Sheet1 A1:A3
'adjust as necessary
sDir = Range("A" & i)
n = n + 1
For nColumn = 1 To 5
Sheets(2).Cells(n, nColumn) = ExecuteExcel4Macro _
("'" & sDir & "[ORF.xlsx]ORF_Charge'!R" & nRow & "C" & nColumn &
"")
Next
Next
End Sub
The only change I made was the file extension "xls" to "xlsx" and
nColumn set to 5.
|