Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 14 Oct 2008 12:04:58 -0500,    group: microsoft.public.word.vba.general        back       


Toggle view macro   
I am new to vba.  I would love to write a simple conditional macro with two 
states for viewing my document.  If the current state of Zoom is 75% 
(viewing the whole page) I would like the macro to switch to zoom of 150%. 
And if the current zoom state is at any other %, I would like for it to 
switch to 75%.  It seems this would be very simple with an if statement. 
But I do not know how to check or change the state of the zoom setting 
within vba.  Could someone help me with this?  Thank you in advance. Bob
date: Tue, 14 Oct 2008 12:04:58 -0500   author:   Bob S

RE: Toggle view macro   
The macro below should do what you want:

Sub ChangeZoom()
    
    With ActiveDocument.ActiveWindow.View.Zoom
        If .Percentage = 75 Then
            .Percentage = 150
        Else
            .Percentage = 75
        End If
    End With
    
End Sub

Note that it is often helpful to record a macro in order to find out in 
which direction you need to go. For example, recording a macro where you 
change the zoom percentage to 75 will result in the following line:

    ActiveWindow.ActivePane.View.Zoom.Percentage = 75

Se also:
http://word.mvps.org/FAQs/MacrosVBA/UsingRecorder.htm

-- 
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"Bob S" wrote:

> I am new to vba.  I would love to write a simple conditional macro with two 
> states for viewing my document.  If the current state of Zoom is 75% 
> (viewing the whole page) I would like the macro to switch to zoom of 150%. 
> And if the current zoom state is at any other %, I would like for it to 
> switch to 75%.  It seems this would be very simple with an if statement. 
> But I do not know how to check or change the state of the zoom setting 
> within vba.  Could someone help me with this?  Thank you in advance. Bob 
> 
> 
>
date: Tue, 14 Oct 2008 14:40:01 -0700   author:   Lene Fredborg

Re: Toggle view macro   
Thank you very much Lene.  The macro works like a champ, and your advice on 
using the recorder was helpful too.  In fact, I bookmarked the link you gave 
for using the recorder to create macros and learn vba along the way.  Thanks 
again.  Bob
"Lene Fredborg"  wrote in message 
news:269EAEEF-6F2C-4477-A9FC-770183574A47@microsoft.com...
> The macro below should do what you want:
>
> Sub ChangeZoom()
>
>    With ActiveDocument.ActiveWindow.View.Zoom
>        If .Percentage = 75 Then
>            .Percentage = 150
>        Else
>            .Percentage = 75
>        End If
>    End With
>
> End Sub
>
> Note that it is often helpful to record a macro in order to find out in
> which direction you need to go. For example, recording a macro where you
> change the zoom percentage to 75 will result in the following line:
>
>    ActiveWindow.ActivePane.View.Zoom.Percentage = 75
>
> Se also:
> http://word.mvps.org/FAQs/MacrosVBA/UsingRecorder.htm
>
> -- 
> Regards
> Lene Fredborg - Microsoft MVP (Word)
> DocTools - Denmark
> www.thedoctools.com
> Document automation - add-ins, macros and templates for Microsoft Word
>
>
> "Bob S" wrote:
>
>> I am new to vba.  I would love to write a simple conditional macro with 
>> two
>> states for viewing my document.  If the current state of Zoom is 75%
>> (viewing the whole page) I would like the macro to switch to zoom of 
>> 150%.
>> And if the current zoom state is at any other %, I would like for it to
>> switch to 75%.  It seems this would be very simple with an if statement.
>> But I do not know how to check or change the state of the zoom setting
>> within vba.  Could someone help me with this?  Thank you in advance. Bob
>>
>>
>>
date: Tue, 14 Oct 2008 20:40:35 -0500   author:   Bob S

Re: Toggle view macro   
You are welcome. I am glad I could help.

Note that you will find many other helpful articles on the Word MVP Site. 
For example, I think the article "Getting To Grips With VBA Basics In 15 
Minutes" could be helpful for you now:
http://www.word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm 

-- 
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"Bob S" wrote:

> Thank you very much Lene.  The macro works like a champ, and your advice on 
> using the recorder was helpful too.  In fact, I bookmarked the link you gave 
> for using the recorder to create macros and learn vba along the way.  Thanks 
> again.  Bob
> "Lene Fredborg"  wrote in message 
> news:269EAEEF-6F2C-4477-A9FC-770183574A47@microsoft.com...
> > The macro below should do what you want:
> >
> > Sub ChangeZoom()
> >
> >    With ActiveDocument.ActiveWindow.View.Zoom
> >        If .Percentage = 75 Then
> >            .Percentage = 150
> >        Else
> >            .Percentage = 75
> >        End If
> >    End With
> >
> > End Sub
> >
> > Note that it is often helpful to record a macro in order to find out in
> > which direction you need to go. For example, recording a macro where you
> > change the zoom percentage to 75 will result in the following line:
> >
> >    ActiveWindow.ActivePane.View.Zoom.Percentage = 75
> >
> > Se also:
> > http://word.mvps.org/FAQs/MacrosVBA/UsingRecorder.htm
> >
> > -- 
> > Regards
> > Lene Fredborg - Microsoft MVP (Word)
> > DocTools - Denmark
> > www.thedoctools.com
> > Document automation - add-ins, macros and templates for Microsoft Word
> >
> >
> > "Bob S" wrote:
> >
> >> I am new to vba.  I would love to write a simple conditional macro with 
> >> two
> >> states for viewing my document.  If the current state of Zoom is 75%
> >> (viewing the whole page) I would like the macro to switch to zoom of 
> >> 150%.
> >> And if the current zoom state is at any other %, I would like for it to
> >> switch to 75%.  It seems this would be very simple with an if statement.
> >> But I do not know how to check or change the state of the zoom setting
> >> within vba.  Could someone help me with this?  Thank you in advance. Bob
> >>
> >>
> >> 
> 
> 
>
date: Wed, 15 Oct 2008 01:03:03 -0700   author:   Lene Fredborg

Re: Toggle view macro   
Good stuff.  Thanks again.
"Lene Fredborg"  wrote in message 
news:BAAA8F38-0B77-4A2E-B98C-55C3197AD007@microsoft.com...
> You are welcome. I am glad I could help.
>
> Note that you will find many other helpful articles on the Word MVP Site.
> For example, I think the article "Getting To Grips With VBA Basics In 15
> Minutes" could be helpful for you now:
> http://www.word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm
>
> -- 
> Regards
> Lene Fredborg - Microsoft MVP (Word)
> DocTools - Denmark
> www.thedoctools.com
> Document automation - add-ins, macros and templates for Microsoft Word
>
>
> "Bob S" wrote:
>
>> Thank you very much Lene.  The macro works like a champ, and your advice 
>> on
>> using the recorder was helpful too.  In fact, I bookmarked the link you 
>> gave
>> for using the recorder to create macros and learn vba along the way. 
>> Thanks
>> again.  Bob
>> "Lene Fredborg"  wrote in message
>> news:269EAEEF-6F2C-4477-A9FC-770183574A47@microsoft.com...
>> > The macro below should do what you want:
>> >
>> > Sub ChangeZoom()
>> >
>> >    With ActiveDocument.ActiveWindow.View.Zoom
>> >        If .Percentage = 75 Then
>> >            .Percentage = 150
>> >        Else
>> >            .Percentage = 75
>> >        End If
>> >    End With
>> >
>> > End Sub
>> >
>> > Note that it is often helpful to record a macro in order to find out in
>> > which direction you need to go. For example, recording a macro where 
>> > you
>> > change the zoom percentage to 75 will result in the following line:
>> >
>> >    ActiveWindow.ActivePane.View.Zoom.Percentage = 75
>> >
>> > Se also:
>> > http://word.mvps.org/FAQs/MacrosVBA/UsingRecorder.htm
>> >
>> > -- 
>> > Regards
>> > Lene Fredborg - Microsoft MVP (Word)
>> > DocTools - Denmark
>> > www.thedoctools.com
>> > Document automation - add-ins, macros and templates for Microsoft Word
>> >
>> >
>> > "Bob S" wrote:
>> >
>> >> I am new to vba.  I would love to write a simple conditional macro 
>> >> with
>> >> two
>> >> states for viewing my document.  If the current state of Zoom is 75%
>> >> (viewing the whole page) I would like the macro to switch to zoom of
>> >> 150%.
>> >> And if the current zoom state is at any other %, I would like for it 
>> >> to
>> >> switch to 75%.  It seems this would be very simple with an if 
>> >> statement.
>> >> But I do not know how to check or change the state of the zoom setting
>> >> within vba.  Could someone help me with this?  Thank you in advance. 
>> >> Bob
>> >>
>> >>
>> >>
>>
>>
>>
date: Wed, 15 Oct 2008 08:56:02 -0500   author:   Bob S

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us