ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change Zoom Value of Window with ComboBox in Custom Menu Control (https://www.excelbanter.com/excel-programming/418631-change-zoom-value-window-combobox-custom-menu-control.html)

RyanH

Change Zoom Value of Window with ComboBox in Custom Menu Control
 
I have a custom menu tab that contains a submenu item which contains 2
comboboxes. The combobox will change the view of several sheets when the
combobox is changed.

1.) How do I set the zoom value of all the sheets with the combobox? If
there is a better way than what I have, please let me know!

Public Sub ChangeDeptViews()

SubName = "ChangeDeptViews"

' make sure Global Schedule is the active sheet
If Not IsGlobalAvailable() Then
Exit Sub
End If

Application.ScreenUpdating = False

' store current sheet
Set wksCurrentSheet = ActiveSheet

Sheets(Array("Engineering", "Graph Prod", "Metal Fab", "Alum Ext", _
"Custom Fab", "Electrical", "Ch Ltrs", "Foam Fab", _
"Metal Paint", "Thermo", "Tri Graphics", "Deco Faces", _
"Tri-Face", "LED", "Crating", "Service",
"Delivery")).Select
Sheets("Engineering").Activate
ActiveWindow.Zoom = CommandBars(1).Controls("Depts. View").Value

' restore sheet that was active
wksCurrentSheet.Activate
Application.ScreenUpdating = False

End Sub


2.) I would also like to change the width of the combobox because it will
only be holding percentages: 100%, 90%, 80%, etc? I have tried this and it
doesn't work.

' Global Schedule View Sub Menu
Set SubMenuItem = MenuItem.Controls.Add(Type:=msoControlComboBox)
With SubMenuItem
.Caption = "Global View"
.OnAction = "OnAction2003Calls"
.Tag = "combo1"
.Width = 10
.AddItem "80%"
.AddItem "90%"
.AddItem "100%"
.AddItem "110%"
.AddItem "120%"
End With

--
Cheers,
Ryan


All times are GMT +1. The time now is 12:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com