Good Morning,
It's been so long since I've tinkered with vba, coding, etc and I can't seem to figure out how to 'edit' the code below. I currently hit a button, and depending on data I have entered, it opens an email using my outlook with the email addresses in the BCC. It works perfect, except that it ONLY works using microsoft outlook. While I see where the application set is Outlook, what can I do to the code to allow any 'default' mail client on different machines to open up? (thunderbird, etc...)
It's been so long since I've tinkered with vba, coding, etc and I can't seem to figure out how to 'edit' the code below. I currently hit a button, and depending on data I have entered, it opens an email using my outlook with the email addresses in the BCC. It works perfect, except that it ONLY works using microsoft outlook. While I see where the application set is Outlook, what can I do to the code to allow any 'default' mail client on different machines to open up? (thunderbird, etc...)
Code:
Private Sub Command76_Click()
Dim strEMail As String
Dim oOutlook As Object
Dim oMail As Object
Dim strAddr As String
Dim MyDb As DAO.Database
Dim rstEMail As DAO.Recordset
Set oOutlook = CreateObject("Outlook.Application")
Set oMail = oOutlook.CreateItem(0)
'Retrieve all E-Mail Addressess in tblEMailAddress
Set MyDb = CurrentDb
Set rstEMail = MyDb.OpenRecordset("Select * From tblEmployee", dbOpenSnapshot, dbOpenForwardOnly)
With rstEMail
Do While Not .EOF
'Build the Recipients String
strEMail = strEMail & ![Email] & ";"
.MoveNext
Loop
End With
'--------------------------------------------------
With oMail
.Bcc = Left$(strEMail, Len(strEMail) - 1) 'Remove Trailing ;
.Body = "Below is the link to a new Schedule"
.Subject = "New Schedule Output"
.display
End With
Set oMail = Nothing
Set oOutlook = Nothing
rstEMail.Close
Set rstEMail = Nothing
End Sub