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.

Mit VB Textdatei öffnen, Daten auswerten

Empfohlene Antworten

Veröffentlicht

Hi,

ich schreibe gerade für Excel ein VB-Makro, was aus einer Textdatei Daten 'filtern' soll (die richtigen Daten) und diese dann an die entsprechenden Stellen in der Excel-Tabelle schreiben soll.

Nun weiss ich aber nicht genau, wie man eine Textdatei einfach als simple ASCII-Textdatei nur zum Lesen öffnet. Ich habe es probiert mit folgender Variante:

...

Dim txtString As String

...

FileAndPath = "C:\work\xl\st.txt"

Open FileAndPath For Output As #1

Line Input #1, txtString

...

Wenn ich es über diese Variante versuche, wird jedoch eine neue Datei mit dem Namen erzeugt und dies ist nicht Sinn und Zweck.

*fleht:* kann mir jemand helfen?

"Output" heisst, dass man aus seinem Programm etwas heraus schreibt. Du brauchst aber "Input". Also:

Dim txtString As String

FileAndPath = "C:\work\xl\st.txt"

Open FileAndPath For Input As #1

Line Input #1, txtString

Das Close #1 nicht vergessen!

String nach Zahl konvertieren (je nach gewünschtem Datentyp unterschiedlich):

CInt()

CLng()

CSng()

CDbl()

CCur()

Anzahl Zeilen ermitteln:

dim anzahl as integer

anzahl = 0

open datei for input as #1

while not eof(1)

anzahl=anzahl+1

wend

close #1

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.