Hallo,
erstmal ist hier der erste Baustein zum öffnen/schreiben/lesen/speichern/schließen der Excel Mappe.
Du solltest aber nicht vergessen einen Verweis auf "Microsoft Excel XXX Object Library" zu setzen unter Tools/References.
mfG
Mario
Function MyFirstXLS()
Dim sPath As String
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim sOutput As String
sPath = "C:\Test.xls"
'Excel laden
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open(sPath)
Set xlSheet = xlBook.ActiveSheet 'Benutzt die Aktive Seite optional über Sheets eine andere Seite auswählen
'Zelle schreiben
xlSheet.Cells(1, 1)="Wert"
'Zelle auslesen
sOutput = xlSheet.Cells(1, 1)
'xlBook.Save oder .SaveAs
xlBook.Close
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
End Function
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP