Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Jim is offline
external usenet poster
 
Posts: 615
Default Excel 2003 object model

Doug/Tom, I found the PageSetup properties! I was under the Sheet object.
Thanks a bunch.

- Jim

"Doug Glancy" wrote:

Jim,

I'm rank beginner at VB.Net, but this works for me. (It's a console app,
but I think it would apply). PageSetup and PrintTitleRows both showed up
in IntelliSense.

Sub create_excel_workbook()
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)
xlSheet.PageSetup.PrintTitleRows = "$3:$3"
' Show the sheet
xlSheet.Application.Visible = True
End Sub

Otherwise, sounds like a post to microsoft.public.dotnet.languages.vb is in
order.

hth,

Doug

"Jim" wrote in message
...
Thanks for the response Doug. This is code inside excel right? meaning VBA
code. I'm actually not doing these modifications in excel/VBA. In an ASP
.NET, I am using FSO and the Excel 2003 reference to open an excel file
and
then modify.

FYI, when I start coding:
Workbook.ActiveSheet, the intellisense is not picking up .PageSetup.
Therefore, Workbook.ActiveSheet.PageSetup does not exist.

"Doug Glancy" wrote:

Jim,

The Macro Recorder is good for figuring out things like this. In XL2003
I
turned on the recorded, changed the margins and got this wealth of info:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 10/8/2004 by Doug Glancy
'

'
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub

hth,

Doug Glancy

"Jim" wrote in message
...
Hello. I'm looking to alter some page setup properties (margins,
orientation,
top row to repeat at top). It seems there are no such properties
(workbook
and worksheet properties) to modify. Or am I incorrect. Any help is
appreciated. This pertains to an app where i open an existing excel
file,
modify, save then leave.

Thanks,
Jim






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
VBA: Where to find Excel Object model? N. Foldager Excel Discussion (Misc queries) 13 February 6th 05 06:43 PM
"Excel.Application" Object Model Shaker Charts and Charting in Excel 2 January 9th 05 10:24 AM
Excel object model Alan Hutchins Excel Programming 0 September 17th 04 11:32 AM
Docs for Excel object model with p/e/m Erv Young Excel Programming 2 January 15th 04 03:11 AM
Subtotals in Excel object model Josh Sale[_2_] Excel Programming 5 October 24th 03 04:28 PM


All times are GMT +1. The time now is 09:21 AM.

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"