Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP/Excel
Message
From
22/07/1999 10:44:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
22/07/1999 10:27:12
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00244705
Message ID:
00244715
Views:
15
>I am needing to format my Page Setup options in Excel from within my VFP code. Does anybody know the proper syntax for:
> 1. Orientation(page tab)=landscape and portrait
> 2. all Margin tabs(margin tab)=top, header, left, right, bottom, and footer
> 3. creating a Custom footer(header/footer tab) for the left, center, and right sections
> 4. Rows to repeat at top(sheet tab)
> 5. and any other page setup options
>
>Thanks for the help.
>
>Lance
Lance,
Check PageSetup object in vbaxl8.hlp. This is extracted just from its page :
With Worksheets("sheet1")
	.PageSetup.Orientation = xlLandscape
	.PrintOut
End With
The With statement makes it easier and faster to set several properties at the same time. The following example sets all the margins for worksheet one.
With Worksheets(1).PageSetup
    .LeftMargin = Application.InchesToPoints(0.5)
    .RightMargin = Application.InchesToPoints(0.75)
    .TopMargin = Application.InchesToPoints(1.5)
    .BottomMargin = Application.InchesToPoints(1)
    .HeaderMargin = Application.InchesToPoints(0.5)
    .FooterMargin = Application.InchesToPoints(0.5)
End With
Converting this to VFP code is near starightforward :
With Worksheets("sheet1")
* Becomes
with oExcel 
   with .Worksheets("sheet1")
...
     with .WorkSheets(1).PageSetup
         .LeftMargin = .Application.InchesToPoints(0.5)
....
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform