[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Reformatting Macro question

Posted on 2004-09-20
1
Medium Priority
?
256 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 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
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 shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Suggested Courses

868 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