ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro "1 tall/1 wide" not working properly (https://www.excelbanter.com/excel-worksheet-functions/8958-macro-%221-tall-1-wide%22-not-working-properly.html)

gizmo

Macro "1 tall/1 wide" not working properly
 
Hi guys,

I prepared the macro that should, among others, make the page fit 1 wide 1
tall.

Sub Landscape_full()
Application.ScreenUpdating = False
With ActiveSheet.PageSetup
.LeftFooter = ActiveWorkbook.FullName
.RightHeader = "&D" & Chr(10) & "&T"
.RightFooter = "&A"
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Application.ScreenUpdating = False
End Sub

However, something goes wrong here.
If I go to the "Page setup" command/"Page" tab, the "Fit to..." field is
changed to the correct values, but the active button stays still with
"Adjust to".
Do you have any idea what should be added to the code?

Thanks a lot,
Gizmo



Don Guillett

try putting this before your .fit to
..Zoom = False

--
Don Guillett
SalesAid Software

"gizmo" wrote in message
...
Hi guys,

I prepared the macro that should, among others, make the page fit 1 wide 1
tall.

Sub Landscape_full()
Application.ScreenUpdating = False
With ActiveSheet.PageSetup
.LeftFooter = ActiveWorkbook.FullName
.RightHeader = "&D" & Chr(10) & "&T"
.RightFooter = "&A"
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Application.ScreenUpdating = False
End Sub

However, something goes wrong here.
If I go to the "Page setup" command/"Page" tab, the "Fit to..." field is
changed to the correct values, but the active button stays still with
"Adjust to".
Do you have any idea what should be added to the code?

Thanks a lot,
Gizmo





Myrna Larson

Don's solution is what you want, but if you turn on the macro recorder, change
that setting back and forth, then compare the macros, you can see which
properties are changed when going from one mode to another.

Of course you get a lot of irrelevant lines, but you'll see that when you
click the upper radio button, .Zoom = 100 is added and there are no .FitTo...
lines; when you click the bottom one, the code includes .Zoom = False and the
..FitTo... lines.


On Mon, 10 Jan 2005 17:12:53 +0100, "gizmo" wrote:

Hi guys,

I prepared the macro that should, among others, make the page fit 1 wide 1
tall.

Sub Landscape_full()
Application.ScreenUpdating = False
With ActiveSheet.PageSetup
.LeftFooter = ActiveWorkbook.FullName
.RightHeader = "&D" & Chr(10) & "&T"
.RightFooter = "&A"
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Application.ScreenUpdating = False
End Sub

However, something goes wrong here.
If I go to the "Page setup" command/"Page" tab, the "Fit to..." field is
changed to the correct values, but the active button stays still with
"Adjust to".
Do you have any idea what should be added to the code?

Thanks a lot,
Gizmo




All times are GMT +1. The time now is 01:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com