VBA Site contains VBA code to create macros in WORD EXCEL ACCESS OUTLOOK

Output

Old data will be deleted in file and new data will be added

Table = b()

Open "C:\MyFile.txt" For Output As #1

For Each element In Table

Dim wrte

wrte = (element)

Write #1, wrte

Next

Close #1

 

Append

New data will be added to existing data, old data will be kept

Open "C:\MyFile.txt" For Append As #1

For Each element In Table

Dim add

add = (element)

Write #1, add

Next

Close #1

 

Input

Data will be taken from file

Dim read

Open "C:\MyFile.txt" For Input As #1

Do While Not EOF(1)

Input #1, read

MsgBox (read)

Loop

Close #1

 

Saving as txt using encoding f.e. "UTF-8"

Data will be saved in a txt file (using encoding f.e. "UTF-8"

File_text = "Yourtext" ' add before and after "Chr(34)" to have txt in quotes

File_name = "Filename"

Your_Path = "C:\" & File_name & ".txt"

stEncoding = "UTF-8" ' or "_autodetect" for ANSI or "Unicode" for UNICODE

Set fso = CreateObject("ADODB.Stream")

With fso

.Type = 2

.Charset = stEncoding

.Open

.WriteText File_text

.SaveToFile Your_Path, 2

End With

Set fso = Nothing



Dodaj komentarz






Dodaj

© 2013-2024 PRV.pl
Strona została stworzona kreatorem stron w serwisie PRV.pl