How to stop user form from disapearing once mail window is closed?

Outlook version
Outlook 2019 64-bit
Email Account
Office 365 Exchange
Hello,

My Outlook VBA code causes a UserForm to pop up at specified times during the day (triggered by the reminders). When it does, the user needs to take action or may close it, depending on the information displayed on that UserForm.

I need to have the possibility to navigate through Outlook while UserForm is still visible. I made it happen by setting ShowModal = False - it's done by one of the buttons (I did not set it straight away in the user form settings as it is important to get user's attention by blocking the application).

Now, there are 2 scenarios:
  • The moment the form pops up, the user is at the main pane (where are all emails, folders). If the form pops up there, user can unfreeze it with button (change of modality setting), then create new email, then send that email (or close or save) and the pop up will still be there in the main pane, waiting to be closed by the different button. This scenario works fine.
  • The moment the form pops up, the user is at the mail view (either writing new email, or just looking at one opened). Then if the pop up shows in that view and user closes that email or sends it, pop up disappears as well.
I would like to achieve either of the two:
a) The pop us shows up always in the main pane, regardless of the current view of the user (he will see it once he goes to the main pane if he's in the middle of writing the email). I think it can conflict with modality set to true at the beginning.
b) The UserForm stays visible regardless if email view is closed (or as long as given button is not clicked).

Could anyone help?

I think the solution may be related to UserForm_QueryClose, as when window view is closed (email sent or closed), this QueryClose is trigerred.

Currently I have the following coder there:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode <> 1 Then
MsgBox "Use a button to close this userform."
Cancel = True
ResultsForm.Hide
ResultsForm.Show
End If
ResultsForm.Hide
ResultsForm.Show
End Sub
I've tried different combinations of Show/Hide properties, however UserForm still closes and is not visible after mail view is closed, even though I receive the msgbox trigerred by that closure.

I have also tried to use ResultsForm.CommandButton1.SetFocus to regain view of the UserForm once Outlook email window is closed, however it does not work.
 
Similar threads
Thread starter Title Forum Replies Date
D Outlook 2016 Outlook Error Msg "The operation cannot be performed ..." How to Stop it Using Outlook 3
T "Words In Recipient's Address" Rule Causes Outlook To Stop Processing Rules Using Outlook 3
Y Outlook 2013 Stop Outlook from automatically assigning categories to Tasks Using Outlook 0
D Any updates or fixes that would make this code stop working just moving emails to another folder Outlook VBA and Custom Forms 1
F Outlook 2016 call to Stop Timer Event Outlook VBA and Custom Forms 4
S stop calendar date reverting to today Using Outlook 7
B Contacts just stop syncing, yesterday... Using Outlook 4
O Stop more than one person responding to an email? Using Outlook 1
A Stop Rule (not turn off) that Delays Outgoing Items Outlook VBA and Custom Forms 1
A Can't stop Outlook.com from setting reminders on appointments? Using Outlook.com accounts in Outlook 3
D Stop meeting acceptance notifications Using Outlook 1
J it goes like outlook has stopped working, a problem caused the program to stop working correctly, wi Using Outlook 2
makinmyway Research Pane in Emails Turns on and Cut Paste Keys then Stop Working Using Outlook 5
J How to Stop OutLook from being Installed Using Outlook 1
A Exchange 2003 how to stop accepting EHLO and AUTH commands Exchange Server Administration 2
M Outlook 2010 IMAP rules occasionaly stop working Using Outlook 4
C How to stop iCloud calendars opening by default Using Outlook 8
icacream outlook 2007 - how do I stop spacing when I hit return ? Using Outlook 4
T Outlook 2007 SSL selfsigned certificate how to stop security popup everytime? Using Outlook 10
Y How do you stop double booking? Using Outlook 1
Commodore Why some RSS feeds stop getting updates? Using Outlook 12
N Rules stop running automatically Using Outlook 10
S Stop mail checking Using Outlook 5
M Can you stop "Microsft Office Outlook is synchronizing folders"? Using Outlook 2
C stop messages to personal folders Using Outlook 2
M Why rules stop running automatically? Using Outlook 1
J Stop Outlook 2010 from showing face pictures in From/To/Cc/Subject box Using Outlook 2
S Shared Calendar Need To Stop Receiving Other Peoples Reminders Using Outlook 3
R Stop Double Booking Rooms Using Outlook 3
C stop facebook? Using Outlook 16
A How do I get Outlook to stop adding a "+1" in front of a telephone number that has an extension. Using Outlook 13
L Outlook inbox is "always in front". How to stop that? BCM (Business Contact Manager) 1
M Stop Search folders from disabling every 1-2 days? Outlook VBA and Custom Forms 3
N VBA Procedure (or Macro) to Stop Outlook from Closing? Outlook VBA and Custom Forms 2
M Stop ribbon item tool tip text from wrapping? Outlook VBA and Custom Forms 2
D Stop automatic opening BCM (Business Contact Manager) 1
C How to stop replies in thier tracks Outlook VBA and Custom Forms 1
A stop outlook reminders generated through BCM BCM (Business Contact Manager) 3
H Information from user defined field into Excel Outlook VBA and Custom Forms 7
D Outlook 2010 Outlook in Windows 10 keeps asking for user name and password repeatedly Using Outlook 14
E Asking user to select multiple options in a list in an email Outlook VBA and Custom Forms 0
icacream Enter your user name and password for the following server. Using Outlook 4
B User defined field for messages with 'me' in the [To], [Cc] line Using Outlook 0
S User Defined Fields adding new value (2) Using Outlook 0
R Creating a user defined function Outlook VBA and Custom Forms 3
M Compile error: User-defined type not defined Outlook VBA and Custom Forms 0
M How to export Voting Results with user names and their responses Outlook VBA and Custom Forms 13
M vCard does not have user-defined fields from my custom contact form (365) Using Outlook 1
C Outlook 2016 Conditional Format for User Defined Field Using Outlook 1
G <mailto:user@domain.com<mailto:user@domain.com<mailto:user@domain.com>>> Using Outlook 5

Similar threads

Top