Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Freezing the screen doesn't word properly in Word 97

Status
Not open for further replies.

mmtraining

IS-IT--Management
Mar 18, 2002
104
DE
Hello People,

I have got a bit confused. I want to freeze the screen whilst VBA is doing a lot of hopping round in the background. The problem is that I get a "ghost" of the headers and footers, which doesn't look very professional.

Code:
Dim temp As String
Application.ScreenUpdating = False     ' WHY DOESN'T THIS BIT WORK???
Schutz_aufheben                        ' this is a sub that removes the document protection
StatusBar = "Bitte warten, die Felder werden aktualisiert"  ' This just tells people what is going on
System.Cursor = wdCursorWait

' Then comes all the hopping around

System.Cursor = wdCursorNormal
Application.ScreenRefresh
Application.ScreenUpdating = True
Any ideas?????

Thanx in advance, :)

Carol
Berlin, Germany
 
try not using the selection object
use range objects instead

I've also used stuff such as

dim oCell as Word.Cell
dim oRow as Word.Row
dim oTable as Word.Table

for each oRow in oTable.Rows
for each oCell in oRow.Cells
' do stuff here
next
next
 
Hi Justin,

I'll try my question in another way. I want to update all the fields in all the headers and footers in a document which has an unknown number of sections.

Any nice fast brilliant ideas?

Carol
Berlin, Germany
 
try something like this

Code:
Option Explicit

Sub test()
  Dim stry As Range
  Dim fld As Field
  
  For Each stry In ActiveDocument.StoryRanges
    Select Case stry.StoryType
      Case wdPrimaryHeaderStory, _
           wdPrimaryFooterStory, _
           wdFirstPageHeaderStory, _
           wdFirstPageFooterStory, _
           wdEvenPagesHeaderStory, _
           wdEvenPagesFooterStory
        For Each fld In stry.Fields
          ' do your stuff here
        Next fld
      Case Else
    End Select
  Next stry
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top