Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Excel Spreadsheets 1

Status
Not open for further replies.

rdmartin

Programmer
Dec 30, 2002
8
0
0
US
I have a table that holds a matrix of reports depending on certain criteria. Each of these reports is a worksheet created in Excel and need to be printed. I have a routine that reads the table (Matrix) and then opens the correct form in a separate instances and then closes that instance. I need to be able to print these worksheets while they are open and then close it to move onto the next instance, instead of previewing them on the screen. I used the preview for development and now need to focus on the actual printing of the worksheets. Any help would be appreciated.
 
Assuming that you made a reference to excel object library in your project:

[tt]' define and set variables
Dim xlApp as New Excel.Application
Dim xlWbk as Excel.Workbook
Set xlWbk=xlApp.Workbooks.Open("FullPath\MyWorkbook.xls")
' print here only part of worksheet
xlWbk.Worksheets(1).Range("A1:H20").Printout Copies:=1, Collate:=True
' clean excel
xlWbk.Close SaveChanges:=False
xlApp.Quit
Set xlWbk = Nothing
Set xlApp = Nothing[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top