Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-10-2018, 09:46 PM
macropod's Avatar
macropod macropod is offline VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters Windows 7 64bit VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,514
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Kalü View Post
The second macro cannot be done in your style because the find what text differs for bold, italic, underlined and highlighted - right?
Not at all. Exactly the same approach can be taken.
Code:
Sub aabFettKursivZieldok()
Application.ScreenUpdating = False
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Format = True
  .Forward = True
  .MatchWildcards = True
  .Wrap = wdFindContinue
  .Replacement.Text = "\1"
  .Text = "°°°°(?@>)''''"
  .Replacement.Font.Underline = True
  .Execute Replace:=wdReplaceAll
  .Replacement.ClearFormatting
  .Text = "§§§(?@>)%%%%"
  .Replacement.Highlight = True
  .Execute Replace:=wdReplaceAll
  .Replacement.ClearFormatting
  .Text = "####(?@>)&&&&"
  .Replacement.Font.Bold = True
  .Execute Replace:=wdReplaceAll
  .Replacement.ClearFormatting
  .Text = "~~(?@>)+++"
  .Replacement.Font.Italic = True
  .Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
Quote:
Originally Posted by Kalü View Post
I thought so too, but please hava alook at the following picture
...
I have no idea why it is doing this
I don't see anything in your post that evidences either your first macro or mine has been run in it (there's none of your prefix/suffix strings, for example).
Quote:
Originally Posted by Kalü View Post
And I have an additional question: Is it possible to turn off hyphenation in the document by using a vba-command and integrate this command in the first macro?
All you need for that is:


ActiveDocument.AutoHyphenation = False
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 04-11-2018, 04:45 AM
Kalü Kalü is offline VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters Windows 10 VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters Office 2010 32bit
Advanced Beginner
VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters
 
Join Date: Apr 2018
Posts: 43
Kalü is on a distinguished road
Default

First of all: Thank you really very much you are helping me a lot!! And wow.. Wish I had more know-how.. Is there any tutorial you can advice me for getting more into vba-macros?

Quote:
I don't see anything in your post that evidences either your first macro or mine has been run in it (there's none of your prefix/suffix strings, for example).
This is because the second macro is deleting all "marks"/strings so tthat the text should look like before... But it doesnt get the highlight and instead continues to format the words bold, also they should be normal.

Strange thing is : it is actually working, just the bold, italic AND highlighted words seem to cause this error. Maybe my "marks" are too long or bad-choosen so that tthey come in conflict when they are next to each other? But i tried it with othe marks and it wasnt working neither... I just cant get whats te problem..
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters Macro to find and replace headings in bold and underline redzan Word VBA 4 02-13-2016 12:24 PM
VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters Find, select, and replace part of text with bold paik1002 Word VBA 4 12-07-2015 11:24 PM
VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters Find and Replace some characters with Bullets kjxavier Word 1 01-02-2015 12:15 AM
VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters Find/Replace Wildcard Needed-Bold & Highlight rsrasc Word VBA 3 11-11-2014 03:55 PM
VBA Find&Replace all bold, itlaic, underlined and highlighted words/characters find and replace in bold redzan Word VBA 1 07-27-2014 03:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:36 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft