+ Reply to Thread
Results 1 to 15 of 15

Stop button flicker going from Print Preview to a sheet.

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Stop button flicker going from Print Preview to a sheet.

    Hello!

    I made this quick labelmaker. The data is on the Data sheet, and on the Form sheet, the user figures out what data (or blank) goes on each label (labels may be duplicated), and then hits a button which brings up the Print Preview/Print of the hidden sheet named Printer.

    The issue I am having is when it goes from Print Preview back to the Form sheet, the buttons appear and it's not smooth. If anyone can improve the code, i'd appreciate it. The pw is "label".

    Thanks!
    Regards,
    leaning
    Attached Files Attached Files

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Stop button flicker going from Print Preview to a sheet.

    Hello leaning,

    I cannot replicate your "Problem". It might have to do with your available RAM.

    You may want to try the Modified Code for the Userform as below:

    Option Explicit
    Sub PrintForms()
    Dim curVis As Long
    Dim sh As Worksheet
    Set sh = ActiveWorkbook.Sheets("Printer")
    ThisWorkbook.Unprotect Password:="label"
    Application.ScreenUpdating = False
    
    With sh
    curVis = .Visible
    .Visible = xlSheetVisible
    .PrintPreview
    .Visible = curVis
    End With
    Worksheets("Form").Activate
    ThisWorkbook.Protect Password:="label"
    Application.ScreenUpdating = True
    End Sub
    Sub EditData()
        
       Application.ScreenUpdating = False
        Worksheets("Data").Activate
        Range("B2").Select
      Application.ScreenUpdating = True
      
    End Sub
    Sub ReturnToForm()
      Application.ScreenUpdating = False
        Worksheets("Form").Activate
        Range("B2").Select
      Application.ScreenUpdating = True
      
    End Sub
    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Stop button flicker going from Print Preview to a sheet.

    Nope. Same thing on my end, even with your modified code. I click "Print Labels" and then the Print Preview box pops up. I click Close Print Preview, and it goes back to the Form sheet, but the buttons are there, then disappear, then come back.
    Maybe because Activate is not the best way to make sure it always comes back to the Form sheet after the Print Preview (instead of the hidden Printer sheet)?

    It works as-is, but it's just a thing.

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,422

    Re: Stop button flicker going from Print Preview to a sheet.

    .
    Does editing the following make a difference ? I've tried saving the changes here to test, but I get a warning
    about macros preventing the save ...

    Sub EditData()
    Application.ScreenUpdating = False
    
        Worksheets("Data").Activate
        Range("B2").Select
    Application.ScreenUpdating = True
    
    End Sub
    
    Sub ReturnToForm()
    Application.ScreenUpdating = False
    
        Worksheets("Form").Activate
        Range("B2").Select
    Application.ScreenUpdating = True
    
    End Sub

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: Stop button flicker going from Print Preview to a sheet.

    Application.ScreenUpdating = False is in the wrong spot.

    I can see movement in the button when you exit print preview. That would be the button finishing being pressed.

    The screen is moving from one window to another, it needs to catchup.

    If you placed a shape on the sheet, and assigning the macro to the shape, the shape would not have a pressing effect.

    Also when you exit the print preview, you don't have to activate the sheet again as it is already the active sheet.

  6. #6
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Stop button flicker going from Print Preview to a sheet.

    All,

    I appreciate the discussion. I started typing in example data and it was creating errors. I was making this too hard. The data is concatenated and then that is used for the data validation list. So now I just LEFTed and RIGHTed that value for the labels. Easy. So here is the newest version which is a way smaller filesize. It still has that behavior, though, where you close Print Preview and the buttons disappear and then reappear. Davesexcel, since you can see it too, what do you recommend with this new version?
    Attached Files Attached Files

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: Stop button flicker going from Print Preview to a sheet.

    I would still refer to post #5,

    Adjusting your data had nothing to do with exiting the print preview.

  8. #8
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Stop button flicker going from Print Preview to a sheet.

    I understand. I remed out the Activate line, but when I close Print Preview, it goes to the Data sheet not the Form sheet as needed. So that line is needed (or something similar) to send it to Form.

    Also, you said that the ScreenUpdating False is in the wrong place. Where did you recommend it move to?

    Sub PrintForms()
    Dim curVis As Long
    Dim sh As Worksheet
    Set sh = ActiveWorkbook.Sheets("Printer")
    ThisWorkbook.Unprotect Password:="label"
    Application.ScreenUpdating = False
    With sh
    curVis = .Visible
    .Visible = xlSheetVisible
    .PrintPreview
    .Visible = curVis
    End With
    Worksheets("Form").Activate
    ThisWorkbook.Protect Password:="label"
    Application.ScreenUpdating = True
    End Sub

  9. #9
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,422

    Re: Stop button flicker going from Print Preview to a sheet.

    .
    Using the suggestion in Post #4 made a difference here. Your second example workbook doesn't create the same issue with saving as it did with the first example workbook.

    I notice there is a slight viewing of the PRINT PREVIEW SHEET when closing it. Here it appears as though the PRINT PREVIEW SHEET disappears from the edges of the page
    and works inward just slightly before the entire sheet is no longer viewable. Is this the flicker you are referring to ? If so, I'm not so certain that can be eliminated.

    Anyone ?

  10. #10
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Stop button flicker going from Print Preview to a sheet.

    Logit,

    What I am seeing (with the Rev 1 workbook):

    1) Open the file to the Form sheet.
    2) Click Print Labels.
    3) Click Close Print Preview.
    4) Watch the View or Edit Data and Print Labels buttons. What I see, they disappear and then reappear. I'd like them to not go in and out like that.

  11. #11
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,422

    Re: Stop button flicker going from Print Preview to a sheet.

    .
    Like Winon, I can't replicate that issue here. The buttons remain in view at all times.

    Sorry.

    What are the specs for your computer ?

  12. #12
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Stop button flicker going from Print Preview to a sheet.

    Wierd. Dell Inspiron 5566 laptop, Intel Core i5-7200U CPU @ 2.5GHz 2.70 GHz, 8GB installed RAM.

    Well, I'm happy to hear it's on my end and not on the user.


    I guess I'm at the final version of this ULINE S-6743 insert card printer thing. I added validation so that the user doesn't enter a colon ( : ) into the data fields because I use that character for the dropdowns, but just that one step jumps the file size up to 10 MB, and even zipped it's too big to upload to this post.

    Crazy. I hope this thread helps somebody!


    Regards,
    leaning

  13. #13
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,422

    Re: Stop button flicker going from Print Preview to a sheet.

    .
    Well, it appears you computer is equipped to handle the project. Not certain what is causing the issue.

    Size of file : Have you saved it as .xlsb ? That will reduce the file size significantly.

  14. #14
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Stop button flicker going from Print Preview to a sheet.

    I didn't know about .xlsb. That's totally cool!

    And thanks to that, here's the final version.

    (That was a hella impressive difference, Logit. )

    Regards,
    leaning
    Attached Files Attached Files

  15. #15
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,422

    Re: Stop button flicker going from Print Preview to a sheet.

    .
    Good show !

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro slows down when I print/print preview/page break a sheet
    By Grug in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-07-2015, 08:59 PM
  2. Disable Print button in Full Print Preview
    By RaquelAR in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-17-2013, 02:03 PM
  3. VBA Macro shows Print Preview page: How to auto-maximize the Print Preview?
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2010, 04:48 PM
  4. Replies: 2
    Last Post: 09-12-2005, 04:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1