Screenupdating and saving new files problem

nicnad

Board Regular
Joined
Sep 12, 2011
Messages
199
Hi,

Here is my code :

It is vba Word code but I think the same still applies to Excel.

Code:
Sub high_risk()
 
On Error GoTo errhandler
Application.screenupdating = false
SaveTempCopy
Dim Letters As Integer, Counter As Integer
Letters = ActiveDocument.Sections.Count
Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter < Letters
docname = "HIGH RISK - " & Left(ActiveDocument.Tables(1).Cell(Row:=2, Column:=1).Range.Text, Len(ActiveDocument.Tables(1).Cell(Row:=2, Column:=1).Range.Text) - 2)
risk = Left(ActiveDocument.Tables(1).Cell(Row:=2, Column:=2).Range.Text, Len(ActiveDocument.Tables(1).Cell(Row:=2, Column:=2).Range.Text) - 2)
ActiveDocument.Sections.First.Range.Cut
If risk = "HIGH RISK" Then
Documents.Add Template:="C:\test\scorecard_template.dotx"
Selection.Paste
ActiveDocument.Sections(2).PageSetup.SectionStart = wdSectionContinuous
ActiveDocument.SaveAs FileName:="C:\test\" & docname, FileFormat:=wdFormatDocument
ActiveWindow.Close
End If
Counter = Counter + 1
Wend
ActiveDocument.Close SaveChanges:=False
Application.screenupdating = true
errhandler:  Exit Sub
End Sub
 
Sub SaveTempCopy()
ActiveDocument.Save
Application.Documents.Add ActiveDocument.FullName
ActiveDocument.SaveAs FileName:="temp"
End Sub

I am using application.screenupdating = false but it seems to work only partially because I still see some flickering and I also see the new documents saving.

Is there another way to disable the screen updating so that I don't see the new file saving and flickering?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Use the following:

Code:
Application.DisplayAlerts = False 
 
'Do stuff

'turn back on
Application.DisplayAlerts = True
 
Upvote 0

Forum statistics

Threads
1,215,759
Messages
6,126,731
Members
449,333
Latest member
Adiadidas

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top