Hi,
Here is my code :
It is vba Word code but I think the same still applies to Excel.
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?
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?