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


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
End With

Set OutLookMailItem = Nothing
Set OutLookApp = Nothing

End Sub



By: Courtney

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

  1. visit website

    I wanted to thank you for this abundant read!! I absolutely enjoyed each little crumb of it. I have got you bookmarked to ensure made known original stuff you post

  2. kertas undangan

    Hello, there. I realize this specific is off-topic, but I had been wondering which blog system are you using intended for this site? I’m having fed up of Blogger because I’ve had difficulties with hackers and I am looking at options with regard to another platform. I would certainly be fantastic in the event you can point me to some sort of good platform.

Comments are closed.