#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default PageSetup

Hi,

I am trying to set the Scaling in Page setup to an optimal zoom %.

I set the Fit to pages wide to say 1 then I want to check what the resulting
zoom to see if I should set it to 2 or more pages wide. But I am having
problems with the PageSetup.Zoom function:

With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesTall = False
.FitToPagesWide = 1
.PrintTitleColumns = False
End With
For x = 2 To 100
With ActiveSheet.PageSetup
If .Zoom < tbxMin_Zoom_Percent.Value Then
.FitToPagesWide = x - 1
x = 100
Else
.FitToPagesWide = x
End If
End With
Next x

Problem:
After setting the pages wide = 1, I want to check what Zoom % that Excel
calculated, then if it is smaller than the Text Box "tbxMin_Zoom_Percent",
then try setting the pages wide to 2, then check the zoom again until the
zoom % is higher than user's selected Minimum.

Problem is the code:
If .Zoom < tbxMin_Zoom_Percent.Value Then
doesn't work

thanks

Simon
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default PageSetup

There is not a really good way to do this, without using the dreaded
SendKeys.

Function FindZoom() As Integer
Dim oText As New DataObject
With Application
.ScreenUpdating = False
.SendKeys ("p%a^c~")
.Dialogs(xlDialogPageSetup).Show
.ScreenUpdating = True
End With
oText.GetFromClipboard
FindZoom = CInt(oText.GetText)
'MsgBox FindZoom
End Function

No error-trapping provided. Also, it's a bit slow, as are most VBA functions
involving PageSetup.

Use SendKeys at your own risk! :-)

--

Vasant





"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
Hi,

I am trying to set the Scaling in Page setup to an optimal zoom %.

I set the Fit to pages wide to say 1 then I want to check what the

resulting
zoom to see if I should set it to 2 or more pages wide. But I am having
problems with the PageSetup.Zoom function:

With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesTall = False
.FitToPagesWide = 1
.PrintTitleColumns = False
End With
For x = 2 To 100
With ActiveSheet.PageSetup
If .Zoom < tbxMin_Zoom_Percent.Value Then
.FitToPagesWide = x - 1
x = 100
Else
.FitToPagesWide = x
End If
End With
Next x

Problem:
After setting the pages wide = 1, I want to check what Zoom % that Excel
calculated, then if it is smaller than the Text Box "tbxMin_Zoom_Percent",
then try setting the pages wide to 2, then check the zoom again until the
zoom % is higher than user's selected Minimum.

Problem is the code:
If .Zoom < tbxMin_Zoom_Percent.Value Then
doesn't work

thanks

Simon



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default PageSetup

Sorry, the SendKeys string should be:

"p%a^c{ESC]"

--

Vasant


"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
There is not a really good way to do this, without using the dreaded
SendKeys.

Function FindZoom() As Integer
Dim oText As New DataObject
With Application
.ScreenUpdating = False
.SendKeys ("p%a^c~")
.Dialogs(xlDialogPageSetup).Show
.ScreenUpdating = True
End With
oText.GetFromClipboard
FindZoom = CInt(oText.GetText)
'MsgBox FindZoom
End Function

No error-trapping provided. Also, it's a bit slow, as are most VBA

functions
involving PageSetup.

Use SendKeys at your own risk! :-)

--

Vasant





"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
Hi,

I am trying to set the Scaling in Page setup to an optimal zoom %.

I set the Fit to pages wide to say 1 then I want to check what the

resulting
zoom to see if I should set it to 2 or more pages wide. But I am having
problems with the PageSetup.Zoom function:

With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesTall = False
.FitToPagesWide = 1
.PrintTitleColumns = False
End With
For x = 2 To 100
With ActiveSheet.PageSetup
If .Zoom < tbxMin_Zoom_Percent.Value Then
.FitToPagesWide = x - 1
x = 100
Else
.FitToPagesWide = x
End If
End With
Next x

Problem:
After setting the pages wide = 1, I want to check what Zoom % that Excel
calculated, then if it is smaller than the Text Box

"tbxMin_Zoom_Percent",
then try setting the pages wide to 2, then check the zoom again until

the
zoom % is higher than user's selected Minimum.

Problem is the code:
If .Zoom < tbxMin_Zoom_Percent.Value Then
doesn't work

thanks

Simon





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default PageSetup

Another version...

Jim Rech and Nick Osdale-Popa posted this that might help:

http://groups.google.com/groups?thre...%40tkmsftngp05

(It has some code to freeze the display, too.)


Simon Shaw wrote:

Hi,

I am trying to set the Scaling in Page setup to an optimal zoom %.

I set the Fit to pages wide to say 1 then I want to check what the resulting
zoom to see if I should set it to 2 or more pages wide. But I am having
problems with the PageSetup.Zoom function:

With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesTall = False
.FitToPagesWide = 1
.PrintTitleColumns = False
End With
For x = 2 To 100
With ActiveSheet.PageSetup
If .Zoom < tbxMin_Zoom_Percent.Value Then
.FitToPagesWide = x - 1
x = 100
Else
.FitToPagesWide = x
End If
End With
Next x

Problem:
After setting the pages wide = 1, I want to check what Zoom % that Excel
calculated, then if it is smaller than the Text Box "tbxMin_Zoom_Percent",
then try setting the pages wide to 2, then check the zoom again until the
zoom % is higher than user's selected Minimum.

Problem is the code:
If .Zoom < tbxMin_Zoom_Percent.Value Then
doesn't work

thanks

Simon


--

Dave Peterson
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
PageSetup Stanley Excel Discussion (Misc queries) 1 December 14th 05 07:21 PM
PageSetup Simon Shaw[_4_] Excel Programming 1 May 28th 04 08:41 AM
VBA 'PageSetup' performance John[_74_] Excel Programming 1 January 29th 04 01:28 AM
SetZoom in PageSetup Bob L[_4_] Excel Programming 0 January 16th 04 04:11 AM


All times are GMT +1. The time now is 08:06 PM.

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"