WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Printing Workbooks from Excel

Keywords: 	 Printing Workbooks from Excel

; Code to print a WorkBook and all of its Sheets.

objExcel  =ObjectCreate("Excel.Application")
objExcel.DisplayAlerts = @FALSE
objExcel.ScreenUpdating = @FALSE
objExcel.AskToUpdateLinks = @FALSE
objWB = objExcel.Workbooks
objWB.Open("C:\1996_BPR.XLS")

;objExcel.Visible = @TRUE
objsheets = objExcel.Worksheets
cnt = objsheets.count

For i = 1 To cnt
 thissheet=ObjExcel.WorkSheets(i)
 thissheet.Printout()
Next

objWorkbookActive = objExcel.ActiveWorkbook
objWorkbookActive.Close(::SaveChanges=@FALSE)
objExcel.Quit
objExcel = 0
Message("All","Done")

Article ID:   W15640
File Created: 2010:09:24:09:18:50
Last Updated: 2010:09:24:09:18:50