I have a generic email form that I open via some buttons on a contact form. Button 1 populates the body of the email form with text 1, button 2 populates it with text 2, etc. I use it for standardized emails to individuals in my contact database.
I want to run some VBA code that attaches certain files based on which button was used to open the email form. (Button 1 on contact form attaches file 1 on email form, button 2 attaches file 2, etc).
I've tried setting a checkbox on the email form when it's opened, and running the code in the OnLoad, OnActivate, and OnOpen events if that flag is checked, but I can't get that to work. I assume it's because the checkbox doesn't get checked until the form is open, activated, or loaded.
So how to I put code on my email form saying "if button 1 was used to open this form, run the code to attach file 1?"
Or, how do I have button 1 call code directly on the email form when it opens?
Thanks in advance!
I want to run some VBA code that attaches certain files based on which button was used to open the email form. (Button 1 on contact form attaches file 1 on email form, button 2 attaches file 2, etc).
I've tried setting a checkbox on the email form when it's opened, and running the code in the OnLoad, OnActivate, and OnOpen events if that flag is checked, but I can't get that to work. I assume it's because the checkbox doesn't get checked until the form is open, activated, or loaded.
So how to I put code on my email form saying "if button 1 was used to open this form, run the code to attach file 1?"
Or, how do I have button 1 call code directly on the email form when it opens?
Thanks in advance!