PDA

View Full Version : Call a UserForm from ItemSend vbModal



Anastasios
06-22-2014, 09:51 AM
Hi all,

I would like to ask for some help with an Outlook 2007 Macro I have created.

The Macro uses the ItemSend Even to modify the Subject of an email about to be sent. From within ItemSend I call a userform (ExampleForm.Show vbModal).

So, when the user clicks on the email's send button the form appears, but while the form is opened the user can click (outside the form) on the email (Outlook.Application.ActiveInspector.CurrentItem) and make changes. This is what I try to avoid. I do not want the user to be able to click outside the form.

I would appreciate any help with this. What I'm trying to do is when the userForm is actived, the user NOT to be able to click outside the form, similar behavior as the MSgBox.


Thanks in advance for your help!
Anastasios

Anastasios
06-22-2014, 03:03 PM
Hi,
I actually found the trick to work and it looks preety simple. Just had to initialise the form with a focus to one of its buttons and did the trick:

Private Sub UserForm_Initialize()
Me.CommandButton1.SetFocus
End Sub