MS Word 2003: Import text file into table

Hi there,

FYI I am an absolute novice when it comes to Word. Here's my question:

I've written a Lisp routine for my Intellicad drafting program that generates a text file with a unique part description on each line.

Ex:

Kitchen--A---CNC Ctop
Kitchen--A---CNC LeftSplash
Kitchen--A---CNC RearSplash
Kitchen--B---CNC Ctop
Kitchen--B---CNC RearSplash
Kitchen--C---CNC Ctop
Kitchen--C---CNC RearSplash
Kitchen--D---CNC Ctop
Kitchen--D---CNC RearSplash

In order to create labels, I am individually pasting in the above text descriptions into my Word label template.

What I would like to know is if there is away that I could create a macro or some kind of routine that would paste all the descriptions into my label template in one shot as opposed to pasting them in individually.

If possible, i would like to set up the macro so that the user could navigate to the current text file folder location (The text file location changes depending on the name of the job)



Thanks for any advice

AJS


P.S. In the future, what I plan on trying to do is link my text file  to an Access database and then create a Crystal Report to run the labels but that's a project for down the road.
Label-Demo.jpg
ynotrobitsAsked:
Who is Participating?
 
Eric FletcherCommented:
No, you need to build the table around the content.

Here are the steps (I am using Word 2003 so if you are on Word 2007, you may need to interpret some menu or dialogs accordingly; they are similar but not exactly the same):

1. Paste your content into a new blank document. Each description should be on a paragraph of its own (i.e. ending with ¶ if you have the view all on).

2. Select everything and convert it to a table. You can either use the Table | Convert, Text to table dialog or click the "Insert Table" button on the toolbar. Either way, you want to end up with a 1-column table with each description in a cell.

3. Now format the table. Select it and right click to get the Format Table dialog. Specify a table width to fit your label width; specify the row height to be exactly X" to fit the label height (and turn off the "allow row to break" checkbox).

4. While selected, set the appropriate cell alignment. In W2003 I use the Tables and Borders toolbar, and use the "Align" button to get what I want; in my example I used align centered (both horizontally and vertically). You can also turn off the borders if you choose, although sometimes it is easier to get the alignment right with them on (do a test print on plain paper and hold it up to the light over a label sheet to make minor adjustments; then remove the borders).

You should now have a column of cells with your descriptions within each one.

5. Use the Columns button (or Format | Columns... dialog) to set everything as 2-columns. You can adjust the column spacing to best fit the label sheet.

You may need to adjust the page setup to get margins that work for your printer and the label sheets. In my example, I set left and right margins to 0.5" and top and bottom to 0.4" and then set the Vertical Alignment to Center to get the full set positioned properly for my printer using a 2x5 layout of 1" labels. You may need to play around a bit to get yours right.

If you do this frequently, consider recording a macro. I always do it manually 1st and then repeat the procedure while recording so I don't record a bunch of adjustments that always seem necessary!

Hope this helps...
0
 
numero_unoCommented:
The Best way that i can suggest is to copy the contents into Excel and make borders there and paste it back into word
0
 
GrahamSkanRetiredCommented:
You can use mail merge with your text file as the datasource. Insert a header line at the start to give a name to each field in the records. You only have the one field at the moment, so a single word such as 'Description' will do it.

Word has a mail merge wizard to help you. How to start it depends on the version. I am using Word 2003.

Make sure that the MailMerge toolbar is visible. The first step of the wizard is to choose the output type. You would need 'Labels'. In the next step, and you can choose the layout by Label manufacturer and number by clicking 'Label options...'

In the next step (Select recipients...) you can choose your text file as the data source. You will be asked for delimiter information. Select '(enter)' for the record delimiter. You only have one field at the moment, so it doesn't matter what you choose for the field delimiter.

In the next steps you can add your field(s) to the first label using the toolbar. Also from the toolbar there is a 'Propagate labels' button to copy the fields to each label.
Follow the steps through to the end. Note that there is a 'preview' button to show how final result will look. It does not complete the process. There are four buttons for that, one for each destination - printer, new document, fax or email.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
Eric FletcherCommented:
Graham's solution will work, but I think an easier way would be just to use tables and styles within Word.

You have only one paragraph type -- the description -- so if you set the format properly, you could just  set everything as a 1-column wide table with cells set to a height that corresponds to your label sheets. With a 2-column layout, the table would flow to the 2nds column so your labels would be presented down one column, then down the 2nd one. The advantage of using tables is that you can specify the cell width and height exactly, and position the contents to be centered both vertically and horizontally within each cell. As well, this can accommodate a situation where a longer description might need to flow onto a 2nd line.

I've attached a mockup of what I mean using your data. The table is set up with row height = exactly 1", and the 2-column layout is set with margins to simulate 1/2" on either side. It is fairly trivial to apply this to a lot of data: just select it all, then convert it to a table with 1 column, then apply the appropriate table properties. You would need to make adjustments to make it fit your label sheets of course.
EE-Qlabels.doc
0
 
ynotrobitsAuthor Commented:
EricFletcher::

Thank you for responding.

I downloaded your label / table but I still seem to have the same problem as with my original label template: When I try and paste the  text file, the individual text lines do not flow from one cell to another---they all group into the first cell.

I tried playing around with the layout features including sorting and text direction but I wasn't able to prevent the text information from grouping

Did you use formatting or style options to direct the text flow, or did you paste the lines individually?

AJS







Label-Paste-Demo.jpg
0
 
ynotrobitsAuthor Commented:
Thank you; that's the ticket!  I'm an OpenOffice use who is  trying to add Word 2007 to my skills repertoire. I have to confess, the ribbon is difficult to navigate if you're not used to it. The shop that will end up using this is using Office 2003.  (I'm working on this at home)  I also have a copy of 2000 and I'm wondering whether I'd be better off creating the macro in 2000 as opposed to 2007. Do you know which version (2000 vs. 2007) would have better macro compatability with 2003?

Thanks again.
0
 
Eric FletcherCommented:
I'm using Word 2003 -- and came from Word 97 to skip Word 2000 -- so don't have any hands-on experience with it. I suspect 2003 and 2007 would be closer than 2000 & 2007 though. I have used Word 2007 (it is installed on a laptop) but tend to stick with a version until I can skip over the following one. The ribbon looks daunting, but you can customize it reasonably easily. As far as I know, most macros work fine on the newer version -- although any that use the ribbon interface would need some tweaking to show properly on it.

Glad it worked for you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.