How to show the progress of the “Fields.Update”-Method in VBA (Word)

前端 未结 1 1599
旧时难觅i
旧时难觅i 2021-01-28 18:28

I\'m trying to update all the fields in a Word document using the \"Fields.Update\"-Method. This is the code I use:

Sub UpdateFields()

Dim varRange As Range

\'         


        
1条回答
  •  情话喂你
    2021-01-28 18:43

    I found a workaround using Fields.Update in combination with selection:

    'Do Field Updates 
    Dim rngCurrentRange As Range
    set varRange = ThisDocument.StoryRanges(wdMainTextStory)
    rngCurrentRange.Select
    Selection.Fields.Update
    

    But there is still a problem with this workaround: At first it doesn't seem to show a progress bar either, but when you run it a second time it does! I'm not sure why this is, but it made it possible to make a workaround: First I update some insignificant StoryRange, which will initialize the progress bar for the following Fields.Update-methods. Unfortunately this does not work for the "first approach" (without using selection).

    0 讨论(0)
提交回复
热议问题