Problem printing on Excel for Mac 2016/2019/365
Results 1 to 5 of 5

Thread: Problem printing on Excel for Mac 2016/2019/365
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Aug 2016
    Posts
    120
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Problem printing on Excel for Mac 2016/2019/365

    I'm making a workbook for both Windows & Mac. I have a button in my workbook that allows them to PRINT worksheets, and another that allows them to make a PDF of worksheets.

    Both buttons work perfectly on Windows. On Mac 2016/2019/365, the PDF button works fine. It’s the PRINT button that sometimes causes a problem. It doesn't work properly when the user has pressed the PDF button before pressing the PRINT button. In that case, the .PrintOut line of code either gives an error, or saves a PDF file instead of printing.

    If I close the workbook and reopen it, it will print fine UNTIL I create a PDF, and then the problem happens again. I feel like this must be a bug in Excel, but am not 100% sure. I can only test it on my one Mac computer, so I know it's possible it might have something to do with my computer.

    I have created a new workbook to test this. This one is only one worksheet and is very simple. I would like to ask the community here if they'd be willing to test it for me. (You need to have Excel for Mac 2016, 2019, or 365.)

    You can download the file at the below link. There are instructions on the worksheet explaining the three steps you should follow. Please post your results back here

    Thank you! It is much appreciated!!

    https://www.dropbox.com/s/lsrsui1st2..._Mac.xlsm?dl=0

  2. #2
    Board Regular
    Join Date
    Aug 2016
    Posts
    120
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Problem printing on Excel for Mac 2016/2019/365

    FYI -- since I haven't received any replies here, I'm going to post this to some other forums.

  3. #3
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    25,407
    Post Thanks / Like
    Mentioned
    442 Post(s)
    Tagged
    45 Thread(s)

    Default Re: Problem printing on Excel for Mac 2016/2019/365

    In that case can you please supply links to any other sites where you have asked this.
    Thanks
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  4. #4
    Board Regular
    Join Date
    Aug 2016
    Posts
    120
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Problem printing on Excel for Mac 2016/2019/365

    I posted it on Stack Overflow and at a Microsoft forum.

  5. #5
    Board Regular
    Join Date
    Aug 2016
    Posts
    120
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Problem printing on Excel for Mac 2016/2019/365

    By the way, if anyone would be willing to try it on their Mac but would rather not download the test workbook I created, here is the code you could insert into a new workbook to test it.

    Code:
    Sub PrintButton()
    
    
    'this should send Sheet1 to the default printer
     
    ThisWorkbook.Sheets("Sheet1").PrintOut Preview:=False, IgnorePrintAreas:=False
    
    
    End Sub
    
    
    Sub PDFButton()
    
    
    'this should create a PDF file of Sheet1 on the Desktop of the Mac
    
    
    Dim UserName As String
    Dim FileNameAndPath As String
    
    
    ThisWorkbook.Sheets("Sheet1").Activate
    
    
    UserName = MacScript("do shell script ""echo $USER""")
    
    
    FileNameAndPath = "/Users/" & UserName & "/Desktop/TestPDF.pdf"
    
    
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    FileNameAndPath, Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False
    
    
    End Sub
    The way to test it is:


    1. Run the PrintButton sub. It should send "Sheet1" to your printer.
    2. Run the PDFButton sub. It should create a PDF of "Sheet1" on your desktop.
    3. Run the PrintButton sub again. This is where the problem is happening for me. I am curious if it works properly for you, or if you receive an error? I received Run-time 1004 error. (I have seen in some circumstances that instead of it printing the sheet here or throwing the error, it makes a PDF when it gets to the .PrintOut line.)
    Last edited by mcomp72; Jun 20th, 2019 at 11:38 AM.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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