View Single Post
 
Old 03-13-2017, 06:41 AM
romanticbiro romanticbiro is offline Windows 7 32bit Office 2003
Advanced Beginner
 
Join Date: Feb 2014
Posts: 42
romanticbiro is on a distinguished road
Default

dear macropod

the senario, that in excel file A: find B: replace
macro run once open .doc file errowr occurs
curser in .doc file not highlite any text

i tried your suggested code with and without .clearFormatting

am i need to run it in office 2010 or higher?

Code:
 
   With wdDoc.Range
      With .Find
.ClearFormatting
.format = true        
        .Replacement.ClearFormatting
.format = true
        .MatchCase = True
        .Wrap = wdFindContinue
        'Set font name
         .Font.Name = "Tahoma"
        .Text = Split(xlFList, "|")(i)
               .Replacement.Font.Name = "Times new roman"
         .Replacement.Text = Split(xlRList, "|")(i)
' Debugger runtime errowr in below line: '        
.Execute Replace:=wdReplaceAll
      End With
    End With


thanks very much
Reply With Quote