Solved

Reformatting Macro question

Posted on 2004-09-20
1
246 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
1 Comment
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There is a feature provided by MS Word that lets you create an Table of Contents for your Word document automatically. To use this feature for other documents there are two steps involved,   1.  Prepare your document for a table of contents (he…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now