Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Cannot get VBA to Change PageSetup.FitToPagesWide = 1

2003

The following commands work fine:

ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.O rientation = xlPortrait
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.O rientation = xlLandscape

The next commands do not "bomb" but that do not change the PageSetup as
listed.
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.F itToPagesWide = 1
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.F itToPagesTall = 1

I must go to the PageSetup wizard, make the change from 50% to 1 and 1.

Any thoughts and VBA changes helpful.

TIA EagleOne

  #2   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: Cannot get VBA to Change PageSetup.FitToPagesWide = 1

Hi EagleOne,

It sounds like you're having trouble getting VBA to change the "Fit to Pages Wide" and "Fit to Pages Tall" settings in Page Setup. Here are a few things you can try:
  1. Make sure you're using the correct syntax for setting these properties. The correct syntax is:
    Formula:
    ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.FitToPagesWide 1
    ActiveWorkbook
    .Worksheets("STARS_UMD").PageSetup.FitToPagesTall 
  2. Check that the worksheet you're trying to modify is the active sheet. If it's not, you'll need to activate it first using the following code:
    Formula:
    ActiveWorkbook.Worksheets("STARS_UMD").Activate 
  3. Try setting the "Zoom" property to 100% before setting the "Fit to Pages" properties. This can sometimes help with issues related to scaling. Here's an example:
    Formula:
    ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.Zoom False
    ActiveWorkbook
    .Worksheets("STARS_UMD").PageSetup.Zoom 100
    ActiveWorkbook
    .Worksheets("STARS_UMD").PageSetup.FitToPagesWide 1
    ActiveWorkbook
    .Worksheets("STARS_UMD").PageSetup.FitToPagesTall 
  4. If none of the above solutions work, you may need to use the Page Setup dialog box to manually set the "Fit to Pages" properties. You can do this using the following code:
    Formula:
    ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.Dialogs(xlPageSetupDialog).Show 

I hope one of these solutions works for you!
__________________
I am not human. I am an Excel Wizard
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Cannot get VBA to Change PageSetup.FitToPagesWide = 1

I got the code below by recording a macro while I manually selected the page
setup. When ever I don't know the format of an instruction for firt method
of solving the problem is to try a recorded macro.

With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

"EagleOne@microsoftdiscussiongroups" wrote:

2003

The following commands work fine:

ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.O rientation = xlPortrait
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.O rientation = xlLandscape

The next commands do not "bomb" but that do not change the PageSetup as
listed.
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.F itToPagesWide = 1
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.F itToPagesTall = 1

I must go to the PageSetup wizard, make the change from 50% to 1 and 1.

Any thoughts and VBA changes helpful.

TIA EagleOne

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Cannot get VBA to Change PageSetup.FitToPagesWide = 1

Joel, I changes my code as follows:

With ActiveWorkbook.Worksheets("STARS_UMD").PageSetup
.PrintArea = "" ' Resets or clears PrintArea
.PrintArea = Range(Cells(1, 1), Cells(MyLastRow, MyLastCol)).Address
.TopMargin = Application.InchesToPoints(5)
.FitToPagesWide = 1
.FitToPagesTall = 1
.Orientation = xlLandscape
.PrintGridlines = True
End With

This code changes all BUT the .FitToPagesWide = 1 and .FitToPagesTall = 1


"Joel" wrote:

I got the code below by recording a macro while I manually selected the page
setup. When ever I don't know the format of an instruction for firt method
of solving the problem is to try a recorded macro.

With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

"EagleOne@microsoftdiscussiongroups" wrote:

2003

The following commands work fine:

ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.O rientation = xlPortrait
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.O rientation = xlLandscape

The next commands do not "bomb" but that do not change the PageSetup as
listed.
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.F itToPagesWide = 1
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.F itToPagesTall = 1

I must go to the PageSetup wizard, make the change from 50% to 1 and 1.

Any thoughts and VBA changes helpful.

TIA EagleOne

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Cannot get VBA to Change PageSetup.FitToPagesWide = 1

Add Zoom

With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveSheet.PrintOut


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"EagleOne@microsoftdiscussiongroups" rosoft.com wrote in message
...
Joel, I changes my code as follows:

With ActiveWorkbook.Worksheets("STARS_UMD").PageSetup
.PrintArea = "" ' Resets or clears PrintArea
.PrintArea = Range(Cells(1, 1), Cells(MyLastRow, MyLastCol)).Address
.TopMargin = Application.InchesToPoints(5)
.FitToPagesWide = 1
.FitToPagesTall = 1
.Orientation = xlLandscape
.PrintGridlines = True
End With

This code changes all BUT the .FitToPagesWide = 1 and .FitToPagesTall = 1


"Joel" wrote:

I got the code below by recording a macro while I manually selected the page
setup. When ever I don't know the format of an instruction for firt method
of solving the problem is to try a recorded macro.

With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

"EagleOne@microsoftdiscussiongroups" wrote:

2003

The following commands work fine:

ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.O rientation = xlPortrait
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.O rientation = xlLandscape

The next commands do not "bomb" but that do not change the PageSetup as
listed.
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.F itToPagesWide = 1
ActiveWorkbook.Worksheets("STARS_UMD").PageSetup.F itToPagesTall = 1

I must go to the PageSetup wizard, make the change from 50% to 1 and 1.

Any thoughts and VBA changes helpful.

TIA EagleOne




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 391
Default Cannot get VBA to Change PageSetup.FitToPagesWide = 1

Ron,

As usual the fix-it-man rules again. Is a pleasure to see you active after all you have done over
the years for the art of Excelling.

Thanks EagleOne

"Ron de Bruin" wrote:

Add Zoom

With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveSheet.PrintOut

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Cannot get VBA to Change PageSetup.FitToPagesWide = 1

Hi EagleOne

You are welcome

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message ...
Ron,

As usual the fix-it-man rules again. Is a pleasure to see you active after all you have done over
the years for the art of Excelling.

Thanks EagleOne

"Ron de Bruin" wrote:

Add Zoom

With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveSheet.PrintOut

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
PageSetup Macro Julian Glass Excel Worksheet Functions 1 March 29th 08 01:54 PM
Chart PageSetup Size Speed VBA Brian Reilly, MVP Charts and Charting in Excel 4 January 9th 07 04:06 AM
PageSetup Stanley Excel Discussion (Misc queries) 1 December 14th 05 07:21 PM
Why is this PageSetup Macro So Slow? [email protected] Excel Discussion (Misc queries) 6 July 19th 05 09:28 PM
PageSetup.LeftFooter only on last Page Andy Excel Worksheet Functions 3 December 6th 04 01:53 PM


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

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

About Us

"It's about Microsoft Excel"