Solved

Reformatting Macro question

Posted on 2004-09-20
1
247 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than man…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

943 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

7 Experts available now in Live!

Get 1:1 Help Now