View Single Post
 
Old 04-16-2018, 06:34 AM
Kalü Kalü is offline Windows 10 Office 2010 32bit
Advanced Beginner
 
Join Date: Apr 2018
Posts: 43
Kalü is on a distinguished road
Default

Ok, I found a simple option to turn off auto numbering in the first macro. That should troubleshoot the problem you described above shouldn't it?

And I also found out that the macro is working way better when I write .Text = "(?@>)" instead of .Text = ""
Because now i dont have whole pages formatted bold or italic.

The only Problem left now is that the second macro does not find and replace words that are tagged with capitalized tags like <B>.
(I actually dont know why the first macro is giving out some capitalized tags, but I think that must be the styles/formatting of the old documents).
I tried to add .MatchCase = False to the second macro, but it makes no difference.

I really overreached my knowledge cap right now and ranning out of ideas... would be so great if you could help me!

The current to macros look like the following (I marked the passages red that I recently added on my own):

Code:
Sub aaaaaQuelldok()
' hyphenation off
ActiveDocument.AutoHyphenation = False
' auto numbering off
ActiveDocument.Range.ListFormat.ConvertNumbersToText
'tag all formatted words
Application.ScreenUpdating = False
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Format = True
  .Forward = True
  .MatchWildcards = True
  .Wrap = wdFindContinue
  .Font.Underline = True
  .Text = "(?@>)"
  .Replacement.Text = "<u>^&</u>"
  .Execute Replace:=wdReplaceAll
  .ClearFormatting
  .Highlight = True
  .Replacement.Text = "<h>^&</h>"
  .Execute Replace:=wdReplaceAll
  .ClearFormatting
  .Font.Bold = True
  .Replacement.Text = "<b>^&</b>"
  .Execute Replace:=wdReplaceAll
  .ClearFormatting
  .Font.Italic = True
  .Replacement.Text = "<i>^&</i>"
  .Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
Code:
Sub aaaaaZieldok()
Application.ScreenUpdating = False
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Format = True
  .Forward = True
  .MatchWildcards = True
.MatchCase = False
  .Wrap = wdFindContinue
  .Replacement.Text = "\1"
  .Text = "\<u\>(*)\</u\>"
  .Replacement.Font.Underline = True
  .Execute Replace:=wdReplaceAll
  .Replacement.ClearFormatting
  .Text = "\<h\>(*)\</h\>"
  .Replacement.Highlight = True
  .Execute Replace:=wdReplaceAll
  .Replacement.ClearFormatting
  .Text = "\<b\>(*)\</b\>"
  .Replacement.Font.Bold = True
  .Execute Replace:=wdReplaceAll
  .Replacement.ClearFormatting
  .Text = "\<i\>(*)\</i\>"
  .Replacement.Font.Italic = True
  .Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
Reply With Quote