A
ArchieDog via OfficeKB.com
Hi All
I'm trying to send a legitimate (i.e. not Spam) email from Word via Outlook
but falling foul of the security warning ("A program is trying to send etc.").
I've had a certain amount of success using SendKeys from Word to deal with
this but would like to know if it is possible to indicate to Outlook that the
message does not need to be spell checked. I can use SendKeys to deal with
this too but then that assumes that the message will always contain words
that Outlook doesn't recognise.
I'm using the following code:
Sub Send_Message(strWhoTo As String, strSubject As String, strFileName As
String, Optional strBodyText As String)
Dim msMAPI As Outlook.Namespace
Dim objOutbox As Outlook.MAPIFolder
Dim objNewMessage As Outlook.MailItem
Dim Message As Integer
If Tasks.Exists("Microsoft Outlook") = True Then
Set msMAPI = Outlook.GetNamespace("MAPI")
Set objOutbox = msMAPI.GetDefaultFolder(olFolderOutbox)
Set objNewMessage = objOutbox.Items.Add
With objNewMessage
.To = strWhoTo
.Subject = strSubject
.Body = strBodyText
If strFileName <> "" Then
If Dir(strFileName) <> "" Then
.Attachments.Add strFileName
End If
End If
.Send
'if the security warning becomes a problem then can this
.Display
SendKeys "^{ENTER}"
'these lines deal with the spell checker so would need to be sure
that it was always going to run
SendKeys "{ESC}"
SendKeys "^{ENTER}"
End With
End if
End Sub
Thanks in advance for any help.
ArchieD
I'm trying to send a legitimate (i.e. not Spam) email from Word via Outlook
but falling foul of the security warning ("A program is trying to send etc.").
I've had a certain amount of success using SendKeys from Word to deal with
this but would like to know if it is possible to indicate to Outlook that the
message does not need to be spell checked. I can use SendKeys to deal with
this too but then that assumes that the message will always contain words
that Outlook doesn't recognise.
I'm using the following code:
Sub Send_Message(strWhoTo As String, strSubject As String, strFileName As
String, Optional strBodyText As String)
Dim msMAPI As Outlook.Namespace
Dim objOutbox As Outlook.MAPIFolder
Dim objNewMessage As Outlook.MailItem
Dim Message As Integer
If Tasks.Exists("Microsoft Outlook") = True Then
Set msMAPI = Outlook.GetNamespace("MAPI")
Set objOutbox = msMAPI.GetDefaultFolder(olFolderOutbox)
Set objNewMessage = objOutbox.Items.Add
With objNewMessage
.To = strWhoTo
.Subject = strSubject
.Body = strBodyText
If strFileName <> "" Then
If Dir(strFileName) <> "" Then
.Attachments.Add strFileName
End If
End If
.Send
'if the security warning becomes a problem then can this
.Display
SendKeys "^{ENTER}"
'these lines deal with the spell checker so would need to be sure
that it was always going to run
SendKeys "{ESC}"
SendKeys "^{ENTER}"
End With
End if
End Sub
Thanks in advance for any help.
ArchieD