2

Someone's sent me a Word file full off address labels separated by tabs. See this sample

I'm trying to figure out the best way to import the addresses into individual records. Probably just go with NameLine, Address1, Address2 for each one (3 fields that I can parse later).

What can I do easily with C# or VBA? Or UltraEdit?

Matt
  • 22,721
  • 17
  • 71
  • 112
Caveatrob
  • 12,667
  • 32
  • 107
  • 187

2 Answers2

1

If all the tabs line up in Word, you should be able to Alt-Select to select individual columns, then cut & paste them into one sequential column so you just get one contiguous file of Address1,Address2,Address3,BlankLine, which should then be trivial to parse.

Chris Ballard
  • 3,771
  • 4
  • 28
  • 40
1

I like Excel for things like this. Just copy the text from Word, paste it into Excel, and use the text import wizard with a tab delimiter, making sure to treat consecutive delimiters as one.

Excel can even parse it for you:

  1. Cut and paste the columns so that it's just one long column with all the addresses. (Let's say column A)
  2. Assuming each address record is 3 lines long, we want to get that into a format with three columns: Name, Address1, Address2.
  3. In Cell B1, create formula =A1.
  4. In Cell C1, create formula =A2.
  5. In Cell D1, create formula =A3.
  6. Select cells B1 through D3, or D4 if you have blank lines between each address record.
  7. Copy.
  8. Go to cell B4, or B5 if there's blank lines between each address record.
  9. CTRL+END to select everything until the end of the data (basically, cells B5:DXX should be selected)
  10. Paste.
  11. Create a new record at the top with your desired fields names.

Example result: example result image

Afterwards, you can copy the results into a new worksheet (sans formulae, so it'll just be static text), format the data however you want it, and sort the data to remove those pesky blank lines.

Pandincus
  • 9,506
  • 9
  • 43
  • 61