![]() |
Printing Excel in Landscape mode...
Hi freinds
I am trying to automate the printing of an Excel document through .NET. I got that part working but I need to do some print setttings such as landscape setup when I am printing the Excel sheet and I could not figureout where to set that property If you can commnent on my mode and give suggestions that will be greatly helpful to me '-------BEGIN CODE--------- Tr Dim myExcel = CreateObject("Excel.Application" Dim myBook = myExcel.Workbooks.Open(Server.MapPath(fileName) Dim wshnetwork = CreateObject("WScript.Network" Dim printerpath As String = "\\Faxprint1\IT-HPCLJ8500 wshnetwork.AddWindowsPrinterConnection(printerpath wshnetwork.SetDefaultPrinter(printerpath myExcel.DisplayAlerts = Fals myExcel.FeatureInstall = Fals myBook.PrintOut( myBook.close( myBook = Nothin myExcel.Quit( myExcel = Nothin Catch ex As Exceptio 'Response.Write(ex.ToString End Tr '-------END CODE--------- Thanks Sai |
Printing Excel in Landscape mode...
go into excel and turn on the macro recorder. Then do file=PageSetup and
change a setting (like landscape) Turn off the macro recorder. then look at the recorded code. -- Regards, Tom Ogilvy "sai" wrote in message ... Hi freinds, I am trying to automate the printing of an Excel document through .NET. I got that part working but I need to do some print setttings such as landscape setup when I am printing the Excel sheet and I could not figureout where to set that property. If you can commnent on my mode and give suggestions that will be greatly helpful to me. '-------BEGIN CODE---------- Try Dim myExcel = CreateObject("Excel.Application") Dim myBook = myExcel.Workbooks.Open(Server.MapPath(fileName)) Dim wshnetwork = CreateObject("WScript.Network") Dim printerpath As String = "\\Faxprint1\IT-HPCLJ8500" wshnetwork.AddWindowsPrinterConnection(printerpath ) wshnetwork.SetDefaultPrinter(printerpath) myExcel.DisplayAlerts = False myExcel.FeatureInstall = False myBook.PrintOut() myBook.close() myBook = Nothing myExcel.Quit() myExcel = Nothing Catch ex As Exception 'Response.Write(ex.ToString) End Try '-------END CODE---------- Thanks, Sai |
All times are GMT +1. The time now is 03:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com