View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
papou[_7_] papou[_7_] is offline
external usenet poster
 
Posts: 41
Default Excel VBA - Exporting values to a txt file

Hello Schumaker

Sub EcrireFichierTexte()
Dim Montexte As String
'adapt path and textfile name
Open "D:\Mes Documents\TestEcriture.txt" For Output As #1
'adpat column
For i = 1 To Range("A65536").End(xlUp).Row
Montexte = Cells(i, 1)
Print #1, Montexte
Next i
Close #1
End Sub

HTH
Regards
Pascal

"schumacker" a écrit dans le message de
om...
Hi everyone!!

i wanna do a macro for an excel file, and i want it to do the
following:

1 - Get the values one by one from a column
2 - Put the values in a txt file.

Example:

Excel file:

A B
1 hello
2 world
3 welcome
4 everybody
5
6
7


Text file:

hello
world
welcome
everybody

It seems to me that this must be very very easy to do, but i am very
very new in the Visual Basic world, and i dont have any idea of the
names of the methods.

If anyone can help me... thanks

Schumacker