Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
sai sai is offline
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
All-in-one printing incompatibility with EXCEL in landscape mode ccorley New Users to Excel 3 September 23rd 09 04:17 PM
half page extra blank in Landscape mode PRINTING Dan Excel Discussion (Misc queries) 2 February 9th 09 02:37 PM
half page extra blank in Landscape mode PRINTING Dan Excel Discussion (Misc queries) 0 February 9th 09 01:49 PM
Why can't I switch to landscape mode? otr-beader Excel Discussion (Misc queries) 2 January 23rd 09 01:47 PM
Changing to Landscape mode automatically Joe McCormick Excel Programming 0 October 7th 03 03:32 PM


All times are GMT +1. The time now is 12:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"