Email code stopped working with Outlook 2003 (1 Viewer)

danikuper

Registered User.
Local time
Today, 11:09
Joined
Feb 6, 2003
Messages
147
Hi there! I've been using this code to send an email directly from my form and it worked great with Outlook 2000. Now that I've upgraded to 2003, the email gets created but the message body is blank!

Here's what I'm using:

Private Sub Image137_Click()
On Error GoTo err_image137_click
Dim strRecipient As String
Dim strSubject As String
Dim strMessage As String

strRecipient = Me.ST_Email

strSubject = "New Activity in Marketing Database"

strMessage = "*** " & CurrentUser & " has assigned a marketing activity for you in the database *** " & vbCrLf & vbCrLf

strMessage = strMessage & "Subject: " & Me.txtExpr2 & " - " & Me.Expr2 & vbCrLf
strMessage = strMessage & "Activity: " & Me.A_Name & vbCrLf
strMessage = strMessage & "Stage: " & Me.AST_Description & vbCrLf
strMessage = strMessage & "Due: " & Me.A_End & vbCrLf

DoCmd.SendObject acSendNoObject, , , strRecipient, , , strSubject, strMessage

exit_image137_click:
Exit Sub

err_image137_click:
If Err.Number = 2501 Then
MsgBox "Email was canceled!", vbInformation
Else
MsgBox Err.Number & "; " & Err.Description
End If
Resume exit_image137_click
End Sub

The To and Subject fields are filled correctly, but the message does not make it to the email. Any ideas why that is happening? Anything changed with Outlook 2003 that I need to update in my code?

Thanks!
:)
 

danikuper

Registered User.
Local time
Today, 11:09
Joined
Feb 6, 2003
Messages
147
I still haven't figured this one out... help anyone?!

thanks.
 

ghudson

Registered User.
Local time
Today, 11:09
Joined
Jun 8, 2002
Messages
6,194
Office and Outlook 2003 both made changes with security so that you can not send emails without the users permission. I can not relate from experience but I have seen many threads discussing the subject. Search the forum for 2003 security or something simular and see what you find.
 

Kodo

"The Shoe"
Local time
Today, 11:09
Joined
Jan 20, 2004
Messages
707
I am not familiar with any way to circumvent this.. for obvious reasons it would defeat the purpose of having a security feature )that is supposed to prevent code execution without the user knowing ) with a known work-around.
 

danikuper

Registered User.
Local time
Today, 11:09
Joined
Feb 6, 2003
Messages
147
It looks like the problem is not a security issue because I'm not trying to send the message without the user intervention. My code opens outlook and creates a new message and waits for the user to send it. The part of opening and creating a new message and entering a subject line works perfectly, but the email body (that should be filled out automatically) comes up blank.

I'll search the forum again to see if I can find something.

thanks!
 

ghudson

Registered User.
Local time
Today, 11:09
Joined
Jun 8, 2002
Messages
6,194
If you use the Application.FollowHyperlink method with the Mailto: command then you can use this to auto fill the email address, subject and memo body...

Code:
Application.FollowHyperlink "mailto:billgates@microsoft.com?subject=Testing 123&body=Hello!", , True
Just replace the strings with your field names to pull the data off of the form. Just remember that field names can not be enclosed within the double quotes.
 

danikuper

Registered User.
Local time
Today, 11:09
Joined
Feb 6, 2003
Messages
147
As you can see from my first post, I'm using the DoCmd.SendObject. I can't find anything wrong with my code (and it was working before I installed Outlook 2003). Any reason why I should go with the followhyperlink method (other than it might solve my problem)?

:)
 

Itintern_Scott

New member
Local time
Today, 08:09
Joined
Sep 30, 2008
Messages
1
Yours:

strMessage = "*** " & CurrentUser & " has assigned a marketing activity for you in the database *** " & vbCrLf & vbCrLf

Possible Error:

strMessage = "*** " & CurrentUser & " has assigned a marketing activity for you in the database " *** " & vbCrLf & vbCrLf

The problem could be possibly that one quote
 

Users who are viewing this thread

Top Bottom