none
ActiveWorkbook.PrintPreview glitche RRS feed

  • Question

  • I created a macro with this code ActiveWorkbook.PrintPreview assigned to a button.  When click only the first worksheet displays not not the workbook.  This code worked at first but it stopped working when I switched to a different computer.  Now when I recreate the macro the code actually changes to

    Sub PreviewWorkBook()

    ' PreviewWorkBook Macro

    ActiveWorkbook.printpreview

    End Sub

    What am I doing wrong?

    Friday, May 29, 2015 5:41 PM

Answers

  • Hi Michele1953,

    >> When click only the first worksheet displays not not the workbook.

    Did you mean that when you click the button, you could see the worksheet printPreview of the activeworksheet? In my option, it is expected. A workbook contains may contains many worksheets. If you want to see the printPreview of all the worksheets, I suggest you loop them like some code below:

    For Each Worksheet In ActiveWorkbook.Sheets
    Worksheet.PrintPreview
    Next

    >> This code worked at first but it stopped working when I switched to a different computer.

    Did you get any error when you switched to a different computer? First of all, I suggest you check whether you could find the vba code in the non-working pc. If it exists, I suggest you check whether you Enable all macros in the non-working pc.

    If it still do not work, I suggest you post a new thread for this issue which is different from the original that only the first worksheet displays, and then there would be more community members to help you focus on the specific issue.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, June 1, 2015 10:02 AM