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:
- 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 = 1
- 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
- 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 = 1
- 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!