I would like to open emails (both new or received) in an inspector window with specific location and a specific size regardless of the locations of previously opened and closed emails.
I have the code to re-size and re-position but what I'm lacking is which event I should put the code in. My best attempt results in the email behaving as desired the first time it loads into the window. However if I then manually re-size or re-position it and switch to another window and back it will re-size / re-position again. I only want it when it loads. Here is the code:
Public WithEvents objInspectors As Outlook.Inspectors Public WithEvents objMailInspector As Outlook.Inspector Private Sub Application_Startup() Set objInspectors = Outlook.Application.Inspectors End Sub Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector) 'Specify the message window If TypeOf Inspector.CurrentItem Is MailItem Then Set objMailInspector = Inspector End If End Sub Private Sub objMailInspector_Activate() With objMailInspector .WindowState = olNormalWindow .Top = -1 .Left = 4655 .Width = 657 .Height = 1041 End With End Sub
So my question is which event I should put it in? Thanks!
Microsoft Outlook for Office 365 MSO (16.0.11029.20045) 32-bit
MS Outlook version 1811





Reply With Quote
