Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
All-in-one printing incompatibility with EXCEL in landscape mode | New Users to Excel | |||
half page extra blank in Landscape mode PRINTING | Excel Discussion (Misc queries) | |||
half page extra blank in Landscape mode PRINTING | Excel Discussion (Misc queries) | |||
Why can't I switch to landscape mode? | Excel Discussion (Misc queries) | |||
Changing to Landscape mode automatically | Excel Programming |