.doc to csv convert

I have a .doc file that I need to convert to .csv. Each record has 8 lines. ie:

Oz Accomodations
FirstName LastName
123 Main Road
City KS, 66214
Phone: 913-555-1212
Fax: 913-555-1234
firstname-lastname at adomain.zzz
http://www.adomain.zzz

need to convert each record into one line .csv file. I had the instructions and now cannot find them.
** edited the sample above so there is no chance it has personal info - b0lsc0tt **

Open in new window

sampledoc.doc
akiles99Asked:
Who is Participating?
 
b0lsc0ttConnect With a Mentor IT ManagerCommented:
I came up with some VBA code that would do this for you.  The code is in the snippet below.  To use it you need to open the VB Editor in Word (Alt + F11).  Access a code page for the sheet or workbook and paste the routine below in.  You can run it in the editor and it will create a new file as you need it.  You would then need to save it with the name you want.
Let me know if you have a question or need more info to use it.
bol

Sub Convert2CSV()
    Dim p As Paragraph
    Dim str As String
    Dim line As String
    For Each p In ActiveDocument.Paragraphs
        line = Trim(Replace(Replace(p.Range.Text, Chr(13), ""), Chr(10), ""))
        If line = "" Then
            str = Left(str, Len(str) - 1) & vbCrLf
        Else
            str = str & """" & line & ""","
        End If
    Next
    
    'MsgBox str
    Set oDoc = Application.Documents.Add
    oDoc.Activate
    ActiveDocument.Range.Text = str
End Sub

Open in new window

0
 
Joseph DalyCommented:
Well heres how I did it.

1. Open the doc in word
2 Select all text and copy
3. Open Excel
4. Select cell A1 and select past special
5. select the option to paste text only

At this point you should have something that looks similar to your word doc but in excel.

7. Select each the rows for each entry and copy.
8. Paste special and then transpose. The entry will now be in a single line
9 Repeat for all the other entries

I have attached an excel doc where you are ready to perform the copy/paste special transpose step.
example.xls
0
 
akiles99Author Commented:
Hi,

I know how to use transpose i'm looking for an better option like any macros.Since it has 200 records...
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
akiles99Author Commented:
Hi,

It is working fine.This is a word macro right?

Thanks,
akiles
0
 
b0lsc0ttIT ManagerCommented:
akiles,
I believe it would actually be considered VBA script.  From what I have read macros are used less and even seem to have changed.  Maybe that is just a change and not really a sign they aren't supported.  I still see the option to Record and depending on how you try to run that routine it could be accessed from a "macros" list.  I guess the answer is at least partially Yes, it is a macro but I don't know that I would use that term for it.  Since I make the scripts and run them from the VB Editor I have thought there was a difference.  If you are curious about the difference it would be worth opening a question for it.  I am sure other experts can explain the difference better or even just how the words are used.
I am glad it did what you need.  Let me know if you have any other questions for this.
bol
0
 
akiles99Author Commented:
Thank u Mr.Admin:)Really thanks for ur time....
0
 
b0lsc0ttIT ManagerCommented:
I'm glad I could help.  Thanks for the grade, the points and the fun question.
bol
0
 
akiles99Author Commented:
Actually i like to learn what are the things we could make using word and excel that's why i have posted the question.

And got a result from an expert...

Thanks for ur help...

EE rocks!!!
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.