Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2005

Tip: Looking for answers? Try searching our database.

Converting Underlines to dashes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Amir - 11 Jun 2005 15:43 GMT
Hi!

I'm trying to build a macro that will search for underlined fonts in all the
document,
and replace them with equivalent number of - characters one line below.

for example:

if 'leads' is underlined:

First sentence leads to secend

sentence in paragraph.

will turn to:
First sentence leads to secend
                      -----
sentence in paragraph.

(The original space between the two sentences was made with line spacing=2,
not with "Enter" key)

I have a function to count how many lines there are in each paragraphs
(CorrectionsMarking_CountLines)

Almost all of the paragraphs in the document have 2 lines line spacing,
and I want that the - signs to go in the 'spaces' between the lines.
Font is always Courier New, size 12 (so that each underlined character
should produce 1 dash because they have the same width)

In order to do so I have to change the line spacing to 1, and add empty
lines to keep the document format.

I'm having difficulties with dealing this problem and I though that maybe
someone has solved it once..

Can anyone help?
Word Heretic - 11 Jun 2005 16:18 GMT
G'day "Amir" <agamy@actcom.co.il>,

This is a non-trivial typsetting problem that I could discuss on a
commercial basis with you. My only help is Selection.Information(Gosh!
Look at all these funky things!) may help you.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice

Amir reckoned:

>Hi!
>
[quoted text clipped - 33 lines]
>
>Can anyone help?
Shauna Kelly - 12 Jun 2005 07:14 GMT
Hi Amir

If you want a rough approach that approximates your requirements, try

Sub ReplaceStraightUnderlineWithDottedUnderlineDoubleSpaced()
   With Selection.Find
       .Text = ""
       .Font.Underline = wdUnderlineSingle
       With .Replacement
           .Text = ""
           .Font.Underline = wdUnderlineDotted
           .ParagraphFormat.LineSpacingRule = wdLineSpaceDouble
       End With
       .Forward = True
       .Wrap = wdFindContinue
       .Format = True
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
       .Execute Replace:=wdReplaceAll
       .Replacement.ClearFormatting
       .ClearFormatting

   End With

End Sub

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word

> G'day "Amir" <agamy@actcom.co.il>,
>
[quoted text clipped - 48 lines]
>>
>>Can anyone help?
Amir - 09 Jul 2005 07:24 GMT
Hi Shauna,

This is a bit different from what I meant.

I meant replacing the underlines with real characters of dashes: '-', which
will be placed under the underlined character.
All characters has the same width in my documents which makes it a bit
easier but still complicated.

I need this in order to convert documents to emulation program which does
not recognizes Word's underlines, therefore needs to use 'real' dashes under
the lines (instead of the 'space').

Thank you for your help.

> Hi Amir
>
[quoted text clipped - 82 lines]
>>>
>>>Can anyone help?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.