I have a VBA code linked to a funtion (if that's the right terminology) that will auto-email a generated PDF using Microsoft Outlook. I'd like to change the method from Outlook to web-based Gmail. Can the following function easily be changed to allow for this or is it a bit more plicomcated?
Code:
Function RDB_Mail_PDF_Outlook(FileNamePDF As String, StrTo As String, _ StrCC As String, StrSubject As String, StrBody As String, Send As Boolean)
If Range("Z1") = True Then Exit Function
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = StrTo
.CC = StrCC
.BCC = ""
.Subject = StrSubject
.Body = Range("C23").Value
.Attachments.Add FileNamePDF
If Send = True Then
.Send
Else
.Display
End If
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Function