0

I am running a sub routine from Outlook VBA that opens an Excel User Form. The calling code in Outlook works great, however the User Form is sometimes hidden underneath other application windows.

How can I ensure my user form always displays on top of every application window?

Code

Sub TMAPAddIn()
Dim ExApp As Object
Set ExApp = CreateObject("Excel.Application")

Dim informationalBox As UserForm2
Set informationalBox = New UserForm2
informationalBox.Show 'letting the user know the workbook is downloading so they dont think Outlook froze

Dim ExWbk As Workbook
Set ExWbk = ExApp.Workbooks.Open("Z/TMAPAddIn.xlam", ReadOnly:=True) 'Z is a network drive

informationalBox.Hide

ExWbk.Application.Run "Module1.example"

ExApp = Nothing
ExWbk = Nothing
End Sub
PP8
  • 197
  • 1
  • 15
  • Why would you not just create the form in outlook instead? Seems kinda a backwards way of doing things... – braX Apr 30 '20 at 04:20
  • Code was written in Excel originally, im just calling my code from my Outlook ribbon as opposed to always having Excel open, plus my TMAPAddIn contains many classes with Interfaces, would be a pain to distribute via Outlook. I dont have time / resources for a COM Add-In – PP8 Apr 30 '20 at 04:29
  • 2
    in short, it's possible, but flawed, and you really should consider some other alternative... but here you go - https://stackoverflow.com/questions/3066082/how-to-keep-my-topmost-window-on-top – braX Apr 30 '20 at 04:32
  • thanks! I dont mind looking for my user form by clicking ALT + Tab on my keyboard to navigate to it either – PP8 Apr 30 '20 at 04:34
  • keep in mind that you can probably just copy/paste or import your Excel form right into Outlook and then make some minor adjustments instead... but good luck.. – braX Apr 30 '20 at 04:40

0 Answers0