View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Getting Zoom Factor

I have never used it, but this was posted in the past:

Here's a post from Jim Rech/Nick Osdale-Popa.

Declare Function LockWindowUpdate Lib _
"user32" (ByVal hwndLock As Long) As Long
Declare Function FindWindowA Lib _
"user32" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long


Sub SetPageZoom()
Dim ZoomFactor As Integer
Dim hWnd As Long


hWnd = FindWindowA("XLMAIN", Application.Caption)
LockWindowUpdate hWnd


With ActiveSheet.PageSetup
.FitToPagesTall = False
.FitToPagesWide = 1
.Zoom = False
End With
'in order to calculate the Zoom %, a PrintPreview must initiated.
SendKeys "%C"
ActiveSheet.PrintPreview
'to get/set the Zoom %, initiate the Page Setup Dialog box.
SendKeys "P%A~"
Application.Dialogs(xlDialogPageSetup).Show
ZoomFactor = ActiveSheet.PageSetup.Zoom
ActiveSheet.PageSetup.Zoom = ZoomFactor


LockWindowUpdate 0
End Sub



--
Regards,
Tom Ogilvy


"HA" wrote:

Sorry for describing the problem on wrong way...

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


the problem is when fit to pages wide and tall selected from page setup (as you see in the code), zoom property set to false automatically.
if fit to page selected, with vba code ActiveSheet.PageSetup.Zoom returns False.
But from page setup dialog box, we can see the zoom factor.
I just want to know on that circumstance, is ther any possiblity to get zoom factor.

thanks...

--
HA
"Bob Phillips" , haber iletisinde şunları ...
activewindow.Zoom

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"HA" wrote in message
...
Hi,

Is there any possiblity to get zooming factor page setup if .zoom property
set to false/true

thanks.

HA