Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2005

Tip: Looking for answers? Try searching our database.

Vba to read column of text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ben - 04 Apr 2005 17:42 GMT
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
Dave Lett - 04 Apr 2005 17:51 GMT
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
> Hi,
>
[quoted text clipped - 23 lines]
> regards,
> ben
Ben - 05 Apr 2005 08:23 GMT
Hi,

Can it be applied to text file?

regards,
Ben

> Hi Ben,
>
[quoted text clipped - 39 lines]
> > regards,
> > ben
Dave Lett - 05 Apr 2005 11:55 GMT
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

> Hi,
>
[quoted text clipped - 46 lines]
> > > regards,
> > > ben
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.