I want both of these scripts to run before I send an email; however, a duplicate command is causing an error message. I really don't know VBA, just enough to copy/paste.
Grammar Check with Spelling
'Occurs before sending email
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objMail As Outlook.MailItem
Dim objMailDocument As Word.Document
Dim objWordApp As Word.Application
Dim strMsg As String
Dim nAnswer As Integer
If TypeOf Item Is MailItem Then
Set objMail = Item
Set objMailDocument = objMail.GetInspector.WordEditor
Set objWordApp = objMailDocument.Application
'Ask you if to spell check
strMsg = "Do you want to spell check the email right now?"
nAnswer = MsgBox(strMsg, vbQuestion + vbYesNo, "Spell Check")
If nAnswer = vbYes Then
'Start spell check
If objWordApp.Options.CheckGrammarWithSpelling = True Then
objMailDocument.CheckGrammar
Else
objMailDocument.CheckSpelling
End If
End If
End If
End Sub
And then this Category script.
'Categorize Sent Items
'Place in ThisOutlookSession
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If TypeOf Item Is Outlook.MailItem And Len(Item.Categories) = 0 Then
Set Item = Application.ActiveInspector.CurrentItem
Item.ShowCategoriesDialog
End If
End Sub