【发布时间】:2021-06-16 16:55:32
【问题描述】:
我目前正在编写一个宏来查找订单的总价。所以我实际上希望宏在 Word 文档中找到“Totaal”(总计)并选择下一个单词,订单的总价格是多少。
例如,总计 € 9.900,78 选择 9.900,78
With ActiveDocument.Range
With Selection.Find
.ClearFormatting
.MatchWholeWord = True
.MatchCase = False
.Execute FindText:="Totaal"
Selection.MoveRight Unit:=wdWord, Count:=2
With Selection
.MoveEndUntil Cset:=",", Count:=wdForward
.MoveRight Unit:=wdCharacter, Count:=0, Extend:=wdExtend
End With
End With
Do While .Find.Found
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
然后,如果它被选中,如果选择/价格高于某个价格,它应该制作一个 msgbox。但我实际上不知道如何实现该功能。我真的希望你们能帮助我。
【问题讨论】: