Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005

    Thumbs up Unanswered: Problem with Printing Excel Worksheet - Resolved

    Every time I try an print an excel worksheet it asks me for the file name.

    My Code is as follows:

    ' Capture the printer
    ' Need to Select the Printer
    Dim ps As New Printing.PrinterSettings
    PrintDialog1.PrinterSettings = ps
    ' Capture the Original Printer
    strDefaultPrinter = Me.PrintDialog1.PrinterSettings.PrinterName
    ' Need to Select the Printer
    strSelectedPrinter = Me.PrintDialog1.PrinterSettings.PrinterName
    ' Change the default printer to reflect the selection
    Call ChangeDefaultPrinter(strSelectedPrinter)

    ' Start Adding Details to a New Excel Workbook
    Dim objApp As Excel.Application
    Dim objBook As Excel._Workbook
    Dim objBooks As Excel.Workbooks
    Dim objSheets As Excel.Sheets
    Dim objSheet As Excel._Worksheet
    Dim range As Excel.Range

    ' Create a new instance of Excel and start a new workbook.
    objApp = New Excel.Application
    objBooks = objApp.Workbooks
    objBook = objBooks.Add
    objSheets = objBook.Worksheets
    objSheet = objSheets(1)

    ' Capture the Details

    ' Print the Excel Document

    The worksheet was able to print until I added the ability to select the printer.

    Any help is greatly appreciated
    Last edited by SonicBoomAu; 01-23-05 at 18:47. Reason: Resolved

  2. #2
    Join Date
    Jan 2005


    I had to set the active printer.

                ' Print the Excel Document
    Hope this helps the next person.

Posting Permissions

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