Word vba screen updating
Screen Updating = True ''//Turn on screen updating End Sub Text boxes in worksheets are sometimes not updated when their text or formatting is changed, and even the Do Event command does not help.
As there is no command in Excel to refresh a worksheet in the way a user form can be refreshed, it is necessary to use a trick to force Excel to update the screen.
o Story is a range of values for updating the formfields in a document Please view code, What happens is Update() is called at the beginning, it asks to input a title, the title is updated for the formfields in the current document ie. What happens next is that Call Sheet Print Out is called which takes the current document file name, searches an excel spreadsheet for the document file name value, then offsets and creates a list called forms of the offsetted value Ex FNList. Once the forms are opened the formfields are then updated and the forms are printed off. Sub Update() Dim Title As String Dim frm Title As User Form1 Dim o Story As Range Application.
These forms are then opened in word like so Set b Doc = Documents. What happens though is that the screenupdating works for the excel part, it then when it gets to word for opening the forms, shows opening the forms and a message appears on the status bar, stating word is updating fields in the current document. Screen Updating = False Set frm Title = New User Form1 With frm Title .
I have tried moving the screenupdating, displayalerts, displaystatusbar to different parts of the doc but i still get this. Display Status Bar = False For Each o Story In Current Doc. (that doesn't let you turn off screen updating..least I haven't found a way to do so for debuggin in 2007)Hey Malik thanks for your reply. Text End With Unload frm Title Set frm Title = Nothing Call Update Story Ranges(Active Document) Call Sheet Print Out Application.
Sub Update Story Ranges(Current Doc As Document) 'Loop to update the main body of the document Application. Story Ranges 'Update the all the Form Fields o Story. Just to confirm i am working in office 2003 and currently not running in debug mode. Screen Updating = True End Sub Sub Sheet Print Out() Dim a Doc As Document Dim b Doc As Document Dim o XL2 As Excel.
When my macro runs i get a message Word is updating the field codes in the document. Then place the names of travel expenses in say D5 and training expenses in F5.
I have tried setting screenupdating, displayalerts, displaystatusbar = false but i still get the message and it shows the macro going to the next doc. Are you using office 2007 and when you run the code you are running in debug mode?
Display Status Bar ''//Get the statusbar display setting Application.
Display Status Bar = True ''//Make sure that the statusbar is visible For i = 1 To i Max ''// imax is usually 30 or so fraction Done = CDbl(i) / CDbl(i Max) Application.
Status Bar = Format(fraction Done, "0%") & " done..." ''// or, alternatively: ''// status Range.value = Format(fraction Done, "0%") & " done..." ''// Some code....... Display Status Bar = boo Status Bar State ''//Reset Status bar display setting Application.Tags: Adult Dating, affair dating, sex dating