+ Reply to Thread
Results 1 to 8 of 8

Setting Sheet Display Zoom Magnification in VBA

Hybrid View

Guest Setting Sheet Display Zoom... 03-16-2005, 11:06 AM
dominicb Good afternoon Kevin This... 03-16-2005, 11:50 AM
Leith Ross Hello Kevin, The following... 03-16-2005, 12:02 PM
Guest Re: Setting Sheet Display... 03-16-2005, 12:06 PM
Guest Re: Setting Sheet Display... 03-16-2005, 12:06 PM
Guest Re: Setting Sheet Display... 03-16-2005, 12:06 PM
Guest Re: Setting Sheet Display... 03-16-2005, 12:06 PM
Guest Re: Setting Sheet Display... 03-16-2005, 04:06 PM
  1. #1
    Kevin
    Guest

    Setting Sheet Display Zoom Magnification in VBA

    Greetings! I am working in Excel 2000 and am looking for the VBA command to
    allow me to set the Worksheet Zoom Magnification programmatically. The
    toolbar has the handy little dropdown list box, but I haven't been able to
    figure out how to do this in code. I found the Zoom command, but that seems
    to refer only to page setup for printing.

    Thanks in advance!
    --
    Kevin

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon Kevin

    This should do just what you want:

    ActiveWindow.Zoom = 50

    This will zoom the currently active to 50%. I have actually linked this command to a scrollbar for an add-in I am compiling, so I have the code available. let me know if you want any more help with this.

    HTH

    DominicB

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Kevin,

    The following code will Zoom the active worksheet to 50%...

    ActiveWindow.Zoom = 50

    This affects only the Active Worksheet, not any other sheets or the printer.

    Hope this helps,
    Leith Ross

  4. #4
    Lonnie M.
    Guest

    Re: Setting Sheet Display Zoom Magnification in VBA

    Hi, ActiveWindow.Zoom = 85 would set the zoom to 85%.
    In the VBA editor if you press F2 it will bring up a search window to
    search the VBA libraries for built in functions, properties, and
    methods. This is very helpful to find things like this.

    HTH--Lonnie M.


  5. #5
    Kevin
    Guest

    Re: Setting Sheet Display Zoom Magnification in VBA

    Thanks, Lonnie!

    That seemed the logical choice, but when I checked the Excel help files it
    kept referring to changing the zoom for printing. VBA's help file leave a lot
    to be desired.

    Thanks again for your help!

    "Lonnie M." wrote:

    > Hi, ActiveWindow.Zoom = 85 would set the zoom to 85%.
    > In the VBA editor if you press F2 it will bring up a search window to
    > search the VBA libraries for built in functions, properties, and
    > methods. This is very helpful to find things like this.
    >
    > HTH--Lonnie M.
    >
    >


  6. #6
    davegb
    Guest

    Re: Setting Sheet Display Zoom Magnification in VBA

    Kevin,
    Another easy way to find this kind of information out is to record a
    simple macro. I just did a "Tools, Macro, Record new macro", typed in
    Zoom for the name, then zoomed to a couple of different settings and
    stopped recording. Then I went to the VBA editor and there was the code.


  7. #7
    Kevin
    Guest

    Re: Setting Sheet Display Zoom Magnification in VBA

    Dave:

    You're absolutely right. I have used that method of recording a macro then
    looking at the code in the past and I'm not sure why I didn't think of it
    this time.

    Is it Friday, yet? :-)

    Thanks!

    "davegb" wrote:

    > Kevin,
    > Another easy way to find this kind of information out is to record a
    > simple macro. I just did a "Tools, Macro, Record new macro", typed in
    > Zoom for the name, then zoomed to a couple of different settings and
    > stopped recording. Then I went to the VBA editor and there was the code.
    >
    >


  8. #8
    davegb
    Guest

    Re: Setting Sheet Display Zoom Magnification in VBA

    Seems slow getting here this week....


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1