Setting Sheet Display Zoom Magnification in VBA

K

Kevin

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!
 
L

Lonnie M.

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.
 
K

Kevin

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!
 
D

davegb

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.
 
K

Kevin

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top