Na stranici John Walkenbach...
http://j-walk.com/ss/excel/tips/tip82.htm naći ćeš interesantnu funkciju koja čita vrednost neke ćelije radne sveske, bez njenog otvaranja.
Code:
Private Function GetValue(path, file, sheet, ref)
' Retrieves 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)
' Execute an XLM macro
GetValue = ExecuteExcel4Macro(arg)
End Function
Ovu funkciju uključi u tvoj kod i onda je pozivaš u petlji sa parametrima mySourcePath, myFile.File, "Sheet1" i "D15" i pomoću nje popunjavaš treću kolonu. Dakle pre iRow = iRow +1 dodaj
Code:
iCol = iCol + 1
Cells(iRow, iCol).Value = GetValue(mySourcePath, myFile.Name, "Sheet1", "D15")
Na temu referenciranja ćelije iz druge radne sveske možeš pogledati i ovde
http://www.elitesecurity.org/t405615-0#2657667
[Ovu poruku je menjao Jpeca dana 08.07.2011. u 11:35 GMT+1]
Nije to loše Rembrante, samo što ne bi dodao još malo boje?