Thread: toggeling Macro
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
JLatham JLatham is offline
external usenet poster
 
Posts: 2,203
Default toggeling Macro

Have you tried:

If ActiveWindow.Zoom = 100 Then
ActiveWindow.Zoom = 120
Else
ActiveWindow.Zoom = 100
End If

(or just to keep your logic)

If ActiveWindow.Zoom = 120 Then
ActiveWindow.Zoom = 100
Else
ActiveWindow.Zoom = 120
End If


"RVF" wrote:

I have several Macro's thst toggle on/off see example text line on/off below

Sub text_wrap()
'
' text_wrap Macro
' Macro recorded 3/24/2008 by Raytheon
'
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom

If .WrapText = False Then

.WrapText = True

Else

.WrapText = False

End If

.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub

this works OK I am trying to write a macro that can zoom in to 120% and
then zoom back out to 100% my code below does not work

Sub zoom()
'
' Zoom Macro
' Macro recorded 3/15/2010 by
'
If ActiveWindow.zoom.Percentage = 120 Then

ActiveWindow.zoom.Percentage = 100
Else

ActiveWindow.zoom.Percentage = 120
End If

End Sub