![]() |
#3
|
||||
|
||||
![]()
Your macro does not convert the document to match the result example. They most obvious difference is the example doesn't use tabs whereas the macro inserts them. To get what you wanted and based solely on the provided examples, you need something like.
Code:
Sub DPU_convertdefinitions() Dim vFindText As Variant Dim vReplaceText As Variant Dim i As Integer vFindText = Array(Chr(34), Chr(9), Chr(32) & Chr(45), Chr(32) & Chr(44), Chr(32) & Chr(41), Chr(32) & Chr(38)) vReplaceText = Array("", " ", Chr(45), Chr(44), Chr(41), Chr(38)) For i = 0 To UBound(vFindText) Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = vFindText(i) .Replacement.Text = vReplaceText(i) .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll End With DoEvents Next i End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Johnmajor | Word VBA | 20 | 02-18-2020 06:59 PM |
Spell check macro within macro button field doesn't work in one document | samuelle | Word VBA | 0 | 07-20-2016 02:27 AM |
![]() |
philpense | Word | 1 | 02-23-2015 04:34 PM |
![]() |
ChrisBrewster | Word VBA | 2 | 02-10-2014 10:33 AM |
Problem: object library invalid or contains references to object definitions | aligahk06 | Office | 0 | 08-19-2010 12:29 PM |