PDA

View Full Version : Detect a click outside the form in my Outlook app



Pirrok
06-28-2021, 10:28 AM
Hello,


I try to facilitate the crossing of information on Outlook.


To do this, I retrieve the item selected in Outlook (an email, an event in the calendar, etc.) with the code below, then I display in a UserForm information related to my selection.


Set myOlSel = Application.ActiveExplorer.Selection
For X = 1 To myOlSel.Count
ElementSelectionne = EvenementSelectionne & myOlSel.Item(X).Subject
Next
TextBox_ElementSelectionne.Value = ElementSelectionne

What I would like is to set the ShowModal parameter of my UserForm to False and detect a MouseUp or the change of selection in my Outlook application so that the information in my UserForm updates itself based on what I have selected with the mouse.
The idea is not to have an update button in my UserForm so that the use is more fluid.


I hope I was clear in my explanations and thank you in advance for your help.


Pirrok.

SamT
06-30-2021, 05:09 PM
I don't know about Outlook, but in excel, I would have to use a WithEvents Class. I hope that helps a bit.