![]() |
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. |
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. |
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. |
All times are GMT +1. The time now is 06:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com