How to keep zoom set to 100% in a workbook?

dkopp3

New Member
Joined
Feb 22, 2019
Messages
5
I'm currently making a form in excel which can dynamically change picture placements based on user input. So far I've done everything without needing to use any VBA. My current issue is that when I zoom out the pictures become misaligned and don't always realign when I zoom back in so I'm looking for a way to keep the zoom at 100% whenever a user might try to change it. I've done a bit of research on the code required but I figured I'd ask here myself.

Here's what I can think of to do:

Code:
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">If Windows("WorkbookName.xlsx").Zoom <> 100 Then
   Windows("WorkbookName.xlsx").Zoom = 100
End If
</code>
This could be totally off but that's why I'm here. Any suggestions on how to do this and where to place the code would be much appreciated.

Thanks!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
How about using this trick ... Place the following code in the ThisWorkbook Module :
Code:
Option Explicit

Private WithEvents cmndbrs As CommandBars


Private Sub Workbook_Open()
    Call SetCommandBarsHook
End Sub


Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    Call SetCommandBarsHook
End Sub


Private Sub SetCommandBarsHook()
    Set cmndbrs = Application.CommandBars
    Call cmndbrs_OnUpdate
End Sub


Private Sub cmndbrs_OnUpdate()
    If Windows(Me.Name).Zoom <> 100 Then Windows(Me.Name).Zoom = 100
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top