Button to send email from google mail (1 Viewer)

nickblitz

Registered User.
Local time
Today, 23:07
Joined
Oct 29, 2012
Messages
30
Dear All,

this is my code to send email using outlook. I have a form that displays the addresses for a category and the button captures all of the email and opens up outlook to send email.

I want to the code to work for google mail.

Can anyone advise how I should edit my code to work with google mail?

Thanks!!! :D:D:D

Code:
Private Sub Command5_Click()
Dim MyDb As DAO.Database
Dim rsEmail As DAO.Recordset
Dim strEmailAddress

Set MyDb = CurrentDb()
Set rsEmail = MyDb.OpenRecordset("Query ASPACEX Contact Officer", dbOpenSnapshot)

Do Until rsEmail.EOF
If Len(rsEmail("Email") & "") > 1 Then
  strEmailAddress = strEmailAddress & rsEmail("Email") & ";"
  End If
  rsEmail.MoveNext
Loop

strEmailAddress = Left(strEmailAddress, Len(strEmailAddress) - 1)

On Error GoTo Err_Command5_Click
Exit_Command5_Click:

DoCmd.SendObject , , acFormatRTF, , _
, strEmailAddress, strSubject, strEMailMsg, True, False

rsEmail.Close
Set rsEmail = Nothing

Exit Sub

Err_Command5_Click:
If Err.Number = 2501 Then
Resume Next
Else
MsgBox Err.Description
Resume Exit_Command5_Click
End If

End Sub
 

spikepl

Eledittingent Beliped
Local time
Today, 17:07
Joined
Nov 3, 2010
Messages
6,142
It's not the code you need to edit. Setup Outlook to use your Google account, and then you are done.
 

nickblitz

Registered User.
Local time
Today, 23:07
Joined
Oct 29, 2012
Messages
30
It's not the code you need to edit. Setup Outlook to use your Google account, and then you are done.

oh i am using a government email. i am not even sure if the code can open up the mail. nevermind. thanks.
 

Users who are viewing this thread

Top Bottom