Screen flicker

pujo

Well-known Member
Joined
Feb 19, 2009
Messages
710
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
When executing the below subroutine, excel will briefly flicker, screen turns black.
How can I stop this from happening?
Thanks!

VBA Code:
Sub SheetAsPDF()
  Application.ScreenUpdating = False
    Dim ws As Worksheet
    Set ws = ActiveSheet
    Dim fileName As String
    
    fileName = ThisWorkbook.Path & "\" & ws.Name & " " & Format(Date, "mm-yyyy") & ".pdf"
      ws.ExportAsFixedFormat Type:=xlTypePDF, fileName:=fileName, Quality:=xlQualityStandard, _
      IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
    MsgBox "Document saved successfully!", vbInformation
  Application.ScreenUpdating = True
End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Remove the two application.screenupdating lines.
 
Upvote 0
Remove the two application.screenupdating lines.
Commented all the application objects one at the time to test.
This had no effect and the screen continues to flicker when executing the subroutine.


Capture.PNG
 
Upvote 0
I can’t see anything there that should cause that. How are you running it?
 
Upvote 0
I can’t see anything there that should cause that. How are you running it?
No event triggers, run command in the vb editor.
Will be assigning to a command button when I get it figured out.

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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