Excel VBAmacros – 用Excel中的一个255以上的句子replaceMicrosoft Word中的引用词
我想用Excel中的段落大于255个字replaceWord上的引用字[Property Manager Notes]。 会有更多像这样的参考。
任何人都可以帮忙。
这里是图片得到一个想法:
这是我正在使用的代码
Dim objWord Dim objDoc Dim oCell As Integer Sub Replacing_excel_word() Sheets("Work").Select Set objWord = CreateObject("Word.Application") Set objDoc = objWord.Documents.Open("C:\Users\Sai\Desktop\xyz.docx") objWord.Visible = True objWord.Activate For oCell = 1 To 50 from_text = Sheets("Work").Range("A" & oCell).Value to_text = Sheets("Work").Range("B" & oCell).Value With objWord.ActiveDocument Set myRange = .Content With myRange.Find .Execute FindText:=from_text, ReplaceWith:=to_text, Replace:=1 End With End With Next oCell End Sub