Results 1 to 17 of 17

Thread: PrintCommunication COM error

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    487

    PrintCommunication COM error

    I am having difficulty with the Application.PrintCommunication property with early binding.

    In the code below, the first DirectCast statement executes without any issues but the second DirectCast statement raises a COM error.

    Code:
    DirectCast(xlSheet.PageSetup, Excel.PageSetup).Application.PrintCommunication = False
    
    With CType(xlSheet, Excel.Worksheet).PageSetup
        .PrintTitleRows = "$1:$1"
        .PrintTitleColumns = ""
        .PrintArea = ""
    End With '...PageSetup
    
    '...setting PrintCommunication property to TRUE raises a COM error 
    DirectCast(xlSheet.PageSetup, Excel.PageSetup).Application.PrintCommunication = True
    The error is "System.Runtime.InteropServices.COMException", which is not very helpful

    Any insight/guidance on how to set the PrintCommunication property to True will be much appreciated.
    Last edited by Mark@SF; Aug 1st, 2022 at 08:05 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width