Google Answers Logo
View Question
 
Q: Need help with simple Word Macro ( No Answer,   2 Comments )
Question  
Subject: Need help with simple Word Macro
Category: Computers > Programming
Asked by: wjwad9-ga
List Price: $5.00
Posted: 08 Dec 2005 11:06 PST
Expires: 07 Jan 2006 11:06 PST
Question ID: 603271
I have a list of a few thousand vocabulary words in a Word Document
that I would like to import into a flash card program.  I have to set
certain parameters to insert the list of words and translations easily
into the two column (two-side) form.  I have a list of words and their
translations, side-by-side, with the only difference being that one
lanuage is underlined.  I want to write a Word Macro that will allow
me to add a TAB SPACE before (or after) each Underlined word, thereby
delineating the difference between each (underlined)English word and
the other word(s) (not underlined), allowing me to properly import the
file according to the parse form.  Since I don't have the time nor the
inclination to learn Visual Basic, could someone help me out with
this?  I use OS X.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Need help with simple Word Macro
From: manuka-ga on 11 Dec 2005 19:16 PST
 
This version adds a tab before each underlined word or phrase. I've
assumed you're using single underlining; if you use a different
underlining style, change the line that reads ".Font.Underline =
wdUnderlineSingle". (Possibilities are: wdUnderlineDashHeavy,
wdUnderlineDashLongHeavy, wdUnderlineDotDashHeavy,
wdUnderlineDotDotDashHeavy, wdUnderlineDottedHeavy, wdUnderlineThick,
wdUnderlineWavyDouble, wdUnderlineWords, wdUnderlineDash,
wdUnderlineDashLong, wdUnderlineDotDash, wdUnderlineDotDotDash,
wdUnderlineDotted, wdUnderlineDouble, wdUnderlineSingle,
wdUnderlineWavy, wdUnderlineWavyHeavy. I trust you can identify which
one is yours!)

Sub TabBeforeUnderlines()
Dim Doc As Document, CurRange As Range, CurFind As Find

Set Doc = ActiveDocument
Set CurRange = Doc.Range

With CurRange.Find
    .ClearFormatting
    .Text = ""
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .Font.Underline = wdUnderlineSingle
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute
End With

Do While CurRange.Find.Found = True
    CurRange.InsertBefore vbTab
    CurRange.Collapse wdCollapseEnd
    CurRange.End = Doc.Range.End
    CurRange.Find.Execute
Loop

End Sub
Subject: Re: Need help with simple Word Macro
From: wjwad9-ga on 12 Dec 2005 09:22 PST
 
Thanks a lot for the help.  What you wrote is very close, but not
quite functioning properly.  The macro keeps cycling on the same line,
putting an infinite number of tab spaces before the first underlined
phrase without moving on to the next line.

If I can't import the text file using the tab format, another way to
import the text file would be in the form of:

Front side of card 1.
Back side of card 1.

Front side of card 2.
Back side of card 2.

Front side of card 3.
Back side of card 3.

with line breaks meaning other card side and blank line breaks
signifying new card.  I am not sure if that would be any easier or
not. (probably not)

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy