Re: Vba to read column of text



Hi Ben,

Without knowing much about your text file, I'm going to say NO because the
text file won't have a table. However, if the text file is tab-delimited, as
in the following:

Name<tab>Age
Lee<tab>23
tan<tab>34
rich<tab>34

Then you can open the text file in Word, convert the appropriate material to
a table and then use the previous routine.

HTH,
Dave

"Ben" <Ben@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3467A48F-00A2-4A47-A4FA-2FE77CC1C5CC@xxxxxxxxxxxxxxxx
> Hi,
>
> Can it be applied to text file?
>
> regards,
> Ben
>
> "Dave Lett" wrote:
>
> > Hi Ben,
> >
> > You could use something as simple as the following:
> >
> >
> > ActiveDocument.Tables(1).Columns(1).Select
> > Selection.Copy
> >
> > Documents.Add
> > Selection.Paste
> >
> >
> > Just be sure that it's really the first table of the document and first
> > column of the table that you want to copy.
> >
> > HTH,
> > Dave
> > "Ben" <Ben@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > news:CDD0A1BC-F1C4-4257-B6D3-57F69C638AFC@xxxxxxxxxxxxxxxx
> > > Hi,
> > >
> > > Is there a way using vba that can copy a particular column of the text
> > that
> > > i want and put into the column of the new file.
> > >
> > > For example:
> > > Existing colum
> > >
> > > Name Age
> > > Lee 23
> > > tan 34
> > > rich 34
> > >
> > >
> > > Copy the column of the name and paste it into new file of a new column
as
> > > below:
> > >
> > > Name
> > > lee
> > > tan
> > > rich
> > >
> > >
> > > please advise.
> > >
> > > thanks.
> > >
> > > regards,
> > > ben
> >
> >
> >


.



Relevant Pages