I am building a dashboard and need to have zoom level set to 100%
. So whenever User tries to Zoom using mouse wheel button or Zoom level option, I need to catch that event and return Zoom to 100%
. I have searched all over internet for answer and found that there is no such thing as OnZoom event.
- There is an option to check zoom level every few milliseconds and restore it to 100%, but i can't accept this cause of rounding circle appearing on mouse arrow constantly, which is distracting.
- Hiding Zoom control is also not an option since user can still zoom with CTRL+MouseWheel.
- Using Class modules also work only on manual selecting zoom level
from menu
View > Zoom
solution
All answers I found were dated more than 5 years ago, so maybe in the meantime someone found a solution or this feature is added in newer versions of Excel?
Any lead will be much appreciated!
Found a solution while playing with ActiveX controls, so for everyone who stumbled on this please find answer below.
First, insert ActiveX control named
InkPicture control
.Resize control across whole Worksheet visible area.
In worksheet module, paste this code.
For some reason (hope someone can explain why?), when zooming occures, it triggers InkPicture_resize event! You can also set InkPicture
visible property
tofalse
, and it will still works.