#1   Report Post  
Posted to microsoft.public.excel.misc
RVF RVF is offline
external usenet poster
 
Posts: 1
Default toggeling Macro

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 457
Default toggeling Macro

Correct coding is just:

ActiveWindow.Zoom = 100

Also, your Text_wrap sub could be greatly condensed to simply be:

With Selection
..WarpText = Not(.WrapText)
End With
--
Best Regards,

Luke M
"RVF" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,533
Default toggeling Macro

Try this one:

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

Regards,
Per

"RVF" skrev i meddelelsen
...
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


  #4   Report Post  
Posted to microsoft.public.excel.misc
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

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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 05:43 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"