Skip to content

Instantly share code, notes, and snippets.

Created March 9, 2016 17:21
Show Gist options
  • Save anonymous/ba092ae9fb41cc48e0af to your computer and use it in GitHub Desktop.
Save anonymous/ba092ae9fb41cc48e0af to your computer and use it in GitHub Desktop.
VBA-Skript zur Einstellung einer bestimmten Zoom-Stufe
Option Explicit
Dim WithEvents myOlExp As Outlook.Explorer ' <===
Dim WithEvents objInspectors As Outlook.Inspectors
Dim WithEvents objOpenInspector As Outlook.Inspector
Dim WithEvents objMailItem As Outlook.MailItem
Private Sub Application_Startup()
Set objInspectors = Application.Inspectors
Set myOlExp = Application.ActiveExplorer ' <===
End Sub
Private Sub Application_Quit()
Set objOpenInspector = Nothing
Set objInspectors = Nothing
Set objMailItem = Nothing
End Sub
Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
If Inspector.CurrentItem.Class = olMail Then
Set objMailItem = Inspector.CurrentItem
Debug.Print "Set objMailItem = Inspector.currentItem"
Set objOpenInspector = Inspector
End If
End Sub
Private Sub objOpenInspector_Close()
Set objMailItem = Nothing
End Sub
Private Sub objOpenInspector_Activate()
Dim wdDoc As Word.Document
On Error Resume Next ' <----
Set wdDoc = objOpenInspector.WordEditor
wdDoc.Windows(1).Panes(1).View.Zoom.Percentage = 150 ' Set zoom level here
On Error GoTo 0 ' <----
End Sub
Private Sub myOlExp_SelectionChange()
Dim currItem As MailItem
On Error Resume Next ' If there is no open mailitem.
Set currItem = Application.ActiveInspector.CurrentItem
objOpenInspector_Activate ' <===
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment