?
Solved

Reformatting Macro question

Posted on 2004-09-20
1
Medium Priority
?
253 Views
Last Modified: 2008-02-01
I have a word document that contains the following (sample only but has a large number of rows:

    ID_INDICATOR_EXT        "EXT"
    ID_INDICATOR_CAPS       "CAP"
    ID_APP_ABOUT            "Display program information, version number and copyright\nAbout"
    ID_APP_EXIT             "Quit the application; prompts to save documents\nExit"
    ID_NEXT_PANE            "Switch to the next window pane\nNext Pane"
    ID_PREV_PANE            "Switch back to the previous window pane\nPrevious Pane"

Can someone give me a macro so that the text is replaced by something like this

myarray(" ID_INDICATOR_EXT") = "EXT"
myarray("ID_INDICATOR_CAPS") =  "CAP"
myarray("ID_APP_ABOUT ") = "Display program information, version number and copyright\nAbout"
-------
-------
so on....

All help is appreciated


0
Comment
Question by:geoenvi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 12109863
It's reasonably simple.

Sub Reformat()
Dim para As Paragraph
Dim Text As String
Dim parts

For Each para In ActiveDocument.Paragraphs
    parts = Split(para.Range.Text, """")
    If UBound(parts) = 2 Then
        para.Range.Text = "myarray(""" & Trim$(parts(0)) & """) = """ & parts(1) & """" & parts(2)
    End If
Next para
End Sub

0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question