The below script will resend emails stuck in the Outbox when sending emails in Outlook. Is there any way to modify this script so that it will automatically run when clicking the Send button? Thanks.

Sub BatchResendEmails(item As Outlook.MailItem)
Dim objFolder As Outlook.MAPIFolder
Dim objMail As Outlook.MailItem
Dim objInspector As Outlook.Inspector
Dim objResendMail As Outlook.MailItem


Set objFolder = Application.Session.GetDefaultFolder(olFolderOutbox)

On Error Resume Next
For Each objMail In objFolder.Items
objMail.Display
Set objInspector = myItem.GetInspector

'Resend message
objInspector.CommandBars.ExecuteMso ("ResendThisMessage")

Set objResendMail = Application.ActiveInspector.CurrentItem

'You can change the email details as per your needs
With objResendMail
.Subject = objMail.Subject
.Send
End With

objMail.Close olDiscard
Next
End Sub