If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
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
Me.PrintDialog1.ShowDialog()
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
etc....
' Print the Excel Document
objApp.Worksheets.PrintOut()
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