Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VB6: von VB Werte in eine Exceltabelle schreiben?

Empfohlene Antworten

Veröffentlicht

Hallo,

ich bin gerade dabei meinen Kollegen die Arbeit bei der Erstellung einer Statistik zu erleichtern.

Ich muss nur noch die Werte in eine Excel Tabelle schreiben. Und da hakt es. Ich habe zwar einiges an Quellcode im Netz gefunden, allerdings arg kompliziert und ich verstehe es leider nicht.

Diese Vorarbeiten habe ich erledigt:

Ich habe in meinem Projekt die Excel Object Library 9.0 eingebunden.

und diese Definitionen habe ich aus einem anderen Projekt übernommen.

Private xlAppl As Excel.Application

Private xlWB As Excel.Workbook

Private xlWS As Excel.Worksheet

Jetzt würde ich gerne möglich einfach eine bestehende ExcelTabelle öffnen und meine Werte in die Zellen eintragen.

Wenn sich jemand damit auskennt, bitte melden :)

So in etwa:


' Defs

'----------------------

Dim oXLS As Excel.Application

Dim oWorkbook As Excel.Workbook

Dim oWorksheet As Excel.Worksheet


' Excel aufmachen

'----------------------

Set oXLS = New Excel.Application


' Wenn du das alles auf false setzt wird das Excel

' nicht sichtbar für den Benutzer aufgemacht, d.h.

' du kannst beliebige Änderungen machen drucken speichern

' oder was weiß ich was und alles im Hintergrund


oXLS.DisplayAlerts = True

oXLS.Visible = True

oXLS.Interactive = True


' Datei öffnen

'----------------------

Set oWorkbook = oXLS.Workbooks.Open("D:\Dokumente\Ausbildungsnachweise\Ausbildungsnachweis.xls")

Set oWorksheet = oWorkbook.Worksheets(1)


' Was reinschreiben

'----------------------

oWorksheet.Range("A1") = "TESTAUSGABE"


' Schließen

'----------------------

oXLS.Quit

Set oXLS = Nothing

Set oWorkbook = Nothing

Set oWorksheet = Nothing

Gruß Diablo999

Vielen, vielen Dank!!! So geht es. Und der Code ist auch leichter zu verstehen als das was ich so gefunden habe. Und vor allem hast du super schnell genantwortet :uli

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.