+ Reply to Thread
Results 1 to 4 of 4

Thread: Parsing a Address Book into Excel

  1. #1
    Registered User
    Join Date
    01-05-2012
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    3

    Parsing a Address Book into Excel

    Hi,

    I have an old address book in Word. I would like to take this and automaticaly add it to an exel spread sheet so i can use it for mail merges etc...

    What is the easiest way to do this?


    In the file the names are in UPPERCASE (the comma is sometimes a period due to the OCR).
    Depending on the listing there are either one or two email address. Same goes for Phone Number.


    -------------------------
    Format of the File:

    LAST, FIRST NAME
    613 N Street
    Los Angeles. CA 41021-4044
    402-944-1494
    email@gmail.com
    Optional2@aol.com
    LAST, FIRST NAME
    615 N Street
    Los Angeles. CA 41021-4044
    402-944-1494
    402-944-1494
    email@gmail.com
    Last edited by bigmouth; 01-05-2012 at 07:14 PM.

  2. #2
    Registered User
    Join Date
    01-05-2012
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Parsing a Address Book into Excel

    My original plan was to do a Replace in Word to add a "," to the begining of every line and then bring that into excel using the delimited option. But i dont knw how to make the next listing into the next row.

  3. #3
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Parsing a Address Book into Excel

    sub snb()
      sn=split(activedocument.content,vbcr)
    
      for j=0 to ubound(sn)-1
        if instr(sn(j),"@")>0 and instr(sn(j+1),"@")=0 then sn(j)=sn(j)& "~"
      next
      sn=split(join(sn,"|"),"~")
    
      with Getobject("E:\OF\example.xls")
         .visible=true
         .sheets(1).cells(1).resize(Ubound(sn)+1)=application.transpose(sn)
      end with
    end sub



  4. #4
    Registered User
    Join Date
    01-05-2012
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Parsing a Address Book into Excel

    Thanks for your help.

    I placed this Macro into the macro editor in word and clicked run an error popped up.


    I am a beginner... So i thank you for your patients!

    Link to txt file: http://dl.dropbox.com/u/9725063/Test.txt
    Last edited by bigmouth; 01-09-2012 at 07:21 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0