Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,comp.lang.basic.visual.misc
external usenet poster
 
Posts: 11
Default Excel: Paper Page Width

Hi,

Is there a way to get a page width (either in points or inches) from
Excel directly?

I had to write my own VB function (see below) just for Letter and
Legal paper but wonder if there is a better way to do it.

==============================
Function PageWidth(xlWB As Excel.Workbook) As Single
With xlWB.ActiveSheet.PageSetup
If .Orientation = xlPortrait Then
PageWidth = 8.5
ElseIf .PaperSize = xlPaperLetter Then
PageWidth = 11
ElseIf .PaperSize = xlPaperLegal Then
PageWidth = 14
Else
PageWidth = 0
End If
End With
End Function
==============================
  #2   Report Post  
Posted to microsoft.public.excel.programming,comp.lang.basic.visual.misc
external usenet poster
 
Posts: 29
Default Excel: Paper Page Width

Kurt,
Depending what you are trying to achieve, this information may not be that
useful, as the amount of page space that you can work with will vary
depending on the type of printer that you have.

If you are concerned where certain values will print, you can use something
like:
ThisWorkbook.Sheets(1).HPageBreaks(1).Location.Add ress

NickHK

"Kurt Remlin" wrote in message
m...
Hi,

Is there a way to get a page width (either in points or inches) from
Excel directly?

I had to write my own VB function (see below) just for Letter and
Legal paper but wonder if there is a better way to do it.

==============================
Function PageWidth(xlWB As Excel.Workbook) As Single
With xlWB.ActiveSheet.PageSetup
If .Orientation = xlPortrait Then
PageWidth = 8.5
ElseIf .PaperSize = xlPaperLetter Then
PageWidth = 11
ElseIf .PaperSize = xlPaperLegal Then
PageWidth = 14
Else
PageWidth = 0
End If
End With
End Function
==============================



  #3   Report Post  
Posted to microsoft.public.excel.programming,comp.lang.basic.visual.misc
external usenet poster
 
Posts: 11
Default Excel: Paper Page Width

I'm trying to calculate the distance (in points, inches or
"columnwidth" units) from the last column to the right margin in order
to extend it all the way to the right.

See http://groups.google.com/groups?hl=en&lr=lang_en|lang_ru&ie=UTF-8&oe=UTF-8&safe=off&selm=4d804b04.0405041018.5bb0f227%40pos ting.google.com
================================================== ===========
"NickHK" wrote in message ...
Kurt,
Depending what you are trying to achieve, this information may not be that
useful, as the amount of page space that you can work with will vary
depending on the type of printer that you have.

If you are concerned where certain values will print, you can use something
like:
ThisWorkbook.Sheets(1).HPageBreaks(1).Location.Add ress

NickHK

"Kurt Remlin" wrote in message
m...
Hi,

Is there a way to get a page width (either in points or inches) from
Excel directly?

I had to write my own VB function (see below) just for Letter and
Legal paper but wonder if there is a better way to do it.

==============================
Function PageWidth(xlWB As Excel.Workbook) As Single
With xlWB.ActiveSheet.PageSetup
If .Orientation = xlPortrait Then
PageWidth = 8.5
ElseIf .PaperSize = xlPaperLetter Then
PageWidth = 11
ElseIf .PaperSize = xlPaperLegal Then
PageWidth = 14
Else
PageWidth = 0
End If
End With
End Function
==============================

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
what is 11" X 17" paper size called in excel page setup? Jeremy Excel Discussion (Misc queries) 4 April 23rd 23 07:44 PM
w/excel how can I have half a page width differ from bottom deb Excel Discussion (Misc queries) 1 June 1st 10 11:02 PM
Measuring cell width and height for printed paper Pekka Numminen Excel Discussion (Misc queries) 6 March 1st 10 10:32 PM
Excel 2003 - PAGE SETUP - FIT TO WIDTH does not work BisBatt Excel Discussion (Misc queries) 1 February 1st 06 07:00 PM
Adjust an Excel table with the width of a Word page [email protected] Excel Discussion (Misc queries) 1 August 2nd 05 10:24 AM


All times are GMT +1. The time now is 07:11 AM.

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

About Us

"It's about Microsoft Excel"