troubleshooting Question

Excel VBA: How to trigger UserForm Activate code

Avatar of Dale James
Dale James asked on
VBAMicrosoft ExcelMicrosoft Office
6 Comments1 Solution7 ViewsLast Modified:
Hello Team

I have the following code within a userform called frmSendEmail

Private Sub UserForm_Activate()
Form_Personalized = FindWindowA(vbNullString, Me.Caption)
STYLE = StartWindow(Form_Personalized, STYLE_CURRENT)
MoveWindow Form_Personalized, STYLE_CURRENT, (STYLE)
End Sub

Open in new window

Within module "SendEmail" the following code is included:

Answer = MsgBox("Do you wish to check report details before producing email and attachment?", vbYesNo, "Mailbox Check")
  If Answer = vbYes Then
   Exit Sub
  End If

Open in new window

When the above code is executed, it does result with the display of the frmSendEmail but the form that is displayed does not include the display of the Maximize and Minimize functions on the userform which would be included if the Private Sub UserForm_Activate() was executed when the is ran.

Can you please advise what I must adjust or include in order for the Private Sub UserForm_Activate() to be triggered when the is executed?

Thank you in advance.


Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros