Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i replace de spaces to tabs

Status
Not open for further replies.

Gti

Programmer
Jul 23, 2001
99
PT
(e.g

XXxxx Yyyyy Zzzzz Qqqqqq Abcdef
Assls Arffe Sdffl FDfsdd Sdffdd

)

I have a txt file and i want convert the spaces whith coluns to the Tab
How can i do it?

 
You can use the Replace function. The code below should do it

Dim NewData As String
Dim Data As String

Open txtfilename for Input As #1
Open txtfilename.new for Append As #2
Do Until EOF(1)
Line Input #1, Data
Newdata = replace(Data," ", Chr(34))
Print #2, Newdata
Loop
Close #1
Close #2
msgbox "completed"

Hope this helps
 
What are you supposed to do if there are consecutive spaces? e.g If I have three spaces in a row between two "words" do you replace them with Three Tabs or with One Tab?
_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top