Adding mandatory fields before being allowed to submit on an excel form

Hello,

I have the below macro on an excel form to submit the form/send an outlook email (my email address was removed–noted in red). I have a few fields on the form that need to be mandatory before users can submit the form, but I’m having trouble finding a macro that can help. Does anyone know if there’s some sort of macro that will not allow the below macro to run until all mandatory cells have information added?

 

Private Sub CommandButton2_Click()

Dim OutLookApp As Object
Dim OutLookMailItem As Object
Dim myAttachments As Object

Set OutLookApp = CreateObject(“OutLook.application”)
Set OutLookMailItem = OutLookApp.CreateItem(0)
Set myAttachments = OutLookMailItem.Attachments

With OutLookMailItem
.To = “email address
.Subject = “Bio Update Form”
.Body = “Please update the attached information.”
myAttachments.Add ActiveWorkbook.FullName
‘.send
.Display
End With

Set OutLookMailItem = Nothing
Set OutLookApp = Nothing

End Sub

 

Thanks!

By: Courtney

184 thoughts on “Adding mandatory fields before being allowed to submit on an excel form

  1. tronenvironmental.com

    Wow, fantastic blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is wonderful, as well as the content!. Thanks For Your article about &.

  2. Personalized Products

    This is really interesting, You are a very skilled blogger. I ave joined your feed and look forward to seeking more of your fantastic post. Also, I have shared your website in my social networks!

  3. go to see

    You ave made some really good points there. I checked on the net to learn more about the issue and found most people will go along with your views on this website.

  4. Best CBD Oil

    This very blog is without a doubt interesting and also diverting. I have chosen many handy tips out of it. I ad love to visit it over and over again. Cheers!

  5. Blythe Truka

    My heart for you is fresh beer, clear and sweet; my affection for you is wine, sweet and sweet; my love for you is knives, strong passion; drunk in my arms, infinite love.

Leave a Reply

Your email address will not be published. Required fields are marked *