Jedna z možností jak získat data z jednoho souboru do druhého. Je potřeba samozřejmě upravit dle svých požadavků a cest.
Sub ReferToExcel()
Dim xlApp As Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Dim x As Long, y As Long
Set xlApp = New Excel.Application
Set wb = xlApp.Workbooks.Open("C:\dokumenty_moje\pokus.xlsm")
Set ws = wb.Sheets("List1")
x = 5
y = 10
Rem --- načtené udaje budou ze sl.10 a řádku 5 Listu1 souboru pokus.xlsm ---
MsgBox "Row 5, Col 10 value=" & ws.Cells(x, y).Value
wb.Close False
Rem Quit Excel
xlApp.Quit
Set xlApp = Nothing
Set wb = Nothing
Set ws = Nothing
End Subcitovat
Sub ReferToExcel()
Dim xlApp As Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Dim x As Long, y As Long
Set xlApp = New Excel.Application
Set wb = xlApp.Workbooks.Open("C:\dokumenty_moje\pokus.xlsm")
Set ws = wb.Sheets("List1")
x = 5
y = 10
Rem --- načtené udaje budou ze sl.10 a řádku 5 Listu1 souboru pokus.xlsm ---
MsgBox "Row 5, Col 10 value=" & ws.Cells(x, y).Value
wb.Close False
Rem Quit Excel
xlApp.Quit
Set xlApp = Nothing
Set wb = Nothing
Set ws = Nothing
End Subcitovat