Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Setting TopMargin Property in VBA

Hi;
Is it possible to make Excel take the TopMargin value from
a variable or a cell. I tried a number of variations and
VBA keeps sending message: 'object does not support this
property or method'
e.g.
....
upmargin = Range("l2")
prtsheet.TopMargin = Application.InchesToPoints(upmargin)
....

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Setting TopMargin Property in VBA

John,

Try this:

With ActiveSheet.PageSetup
.TopMargin = Application.InchesToPoints(Range("A1"))
End With

or
x = 0.5
With ActiveSheet.PageSetup
.TopMargin = Application.InchesToPoints(x)
End With

--
sb
"John S." wrote in message
...
Hi;
Is it possible to make Excel take the TopMargin value from
a variable or a cell. I tried a number of variations and
VBA keeps sending message: 'object does not support this
property or method'
e.g.
...
upmargin = Range("l2")
prtsheet.TopMargin = Application.InchesToPoints(upmargin)
...

Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Setting TopMargin Property in VBA

John,

TopMargin is a property of the PageSetup object, so try something like

prtsheet.PageSetup.TopMargin = Application.InchesToPoints(Range("A1").Value)



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"John S." wrote in message
...
Hi;
Is it possible to make Excel take the TopMargin value from
a variable or a cell. I tried a number of variations and
VBA keeps sending message: 'object does not support this
property or method'
e.g.
...
upmargin = Range("l2")
prtsheet.TopMargin = Application.InchesToPoints(upmargin)
...

Thanks.



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
setting default filter setting tpeter Charts and Charting in Excel 0 December 4th 09 02:50 PM
setting XValues property when charting using macros rhsiao Charts and Charting in Excel 3 April 7th 06 04:16 PM
Error setting shape text property Sarge Charts and Charting in Excel 2 January 11th 06 03:31 AM
Setting default pivot table field setting to "sum" Mr. Moose Excel Discussion (Misc queries) 2 December 21st 04 04:43 PM
setting formula property Ed Stevens Excel Programming 1 September 9th 03 04:59 AM


All times are GMT +1. The time now is 01:25 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"