I have no
vb to test, it works for
vb-script; try it yourself.
Dim ExcelApp, ExcelWb
Set ExcelApp = CreateObject("Excel.Application")
Set ExcelWb = ExcelApp.WorkBooks.Open("yourfile.xls")
ExcelWb.WorkSheets.PrintOut
ExcelApp.Quit
Set ExcelObj = Nothing
"KitCaz" wrote:
Recently someone provided some succinct code to print Word documents from VB
code. Can someone provide similar code for printing Excel files?
e.g. Word code:
Dim WordObj As Object
Set WordObj = CreateObject("Word.Application")
WordObj.Documents.Open "c:\yourfile.doc"
WordObj.PrintOut Background:=False, Copies:=1
WordObj.Quit
Set WordObj = Nothing