Email Through Windows Live!

B

Bob Vance

Is it possible to alter my email code so as it can be used in the latest
Windows Verion , Windows7 "Windows Live"
Thanks Bob

Private Sub SendMailButton_Click()


If Me.Dirty = True Then
Me.Dirty = False
Dim myfile1 As String, myfile2 As String
End If
Dim mydir As String
mydir = Left(CurrentDb.Name, Len(CurrentDb.Name) -
Len(Dir(CurrentDb.Name)))
Dim lngID As Long, strMail As String, strBodyMsg As String, _
blEditMail As Boolean, sndReport As String, strCompany As String
Dim msgPmt As String, msgBtns As Integer, msgTitle As String, msgResp As
Integer, tbAmount As String
Dim strFormat As String
Dim mytot As Long
mytot = DCount("[InvoiceID]", "qrySelInvoices", "")

Select Case Me.tbEmailOption.value

Case "ADOBE"
strFormat = acFormatPDF
myfile1 = mydir & "Statement.pdf"
myfile2 = mydir & "Invoices.pdf"
Case "WORD"
strFormat = acFormatRTF
myfile1 = mydir & "Statement.rtf"
myfile2 = mydir & "Invoices.rtf"

Case "SNAPSHOT"
strFormat = acFormatSNP
myfile1 = mydir & "Statement.SNP"
myfile2 = mydir & "Invoices.SNP"

Case "TEXT"
strFormat = acFormatTXT
myfile1 = mydir & "Statement.txt"
myfile2 = mydir & "Invoices.txt"

Case "HTML"
strFormat = acFormatHTML
myfile1 = mydir & "Statement.htm"
myfile2 = mydir & "Invoices.htm"

Case Else ' catch all others
strFormat = acFormatHTML
myfile1 = mydir & "Statement.htm"
myfile2 = mydir & "Invoices.htm"

End Select

Select Case Me.OpenArgs

Case "OwnerStatement"

sndReport = "rptOwnerPaymentMethod"


lngID = Nz(Me.cbOwnerName.Column(0), 0)
strMail = OwnerEmailAddress(lngID)
tbAmount = Nz(Me.cbOwnerName.Column(5), 0)

strBodyMsg = "To: "
strBodyMsg = strBodyMsg & Nz(DLookup("[ClientTitle]",
"tblOwnerInfo", _
"[OwnerID]=" & lngID), " ") & " "
strBodyMsg = strBodyMsg & Nz(DLookup("[OwnerLastName]",
"tblOwnerInfo", _
"[OwnerID]=" & lngID), " Owner")
strBodyMsg = strBodyMsg & "," & Chr(10) & Chr(10) & Chr(13) _
& "Please find attached your Statement/Invoices, Dated:" & " "
& Format(Date, "d-mmm-yyyy") & Chr(10) & "Your Statement Total: " &
Format(tbAmount, "$ #,##.00") & Chr(10) & Chr(10) &
Nz(DLookup("[EmailMessage]", "tblCompanyInfo"), "") & eMailSignature("Best
Regards", True) & Chr(10) & Chr(10) & DownloadMessage("PDF") _


DoCmd.OutputTo acOutputReport, sndReport, strFormat,
myfile1, False
If mytot > 0 Then
DoCmd.OutputTo acOutputReport, "rptInvoiceModify",
strFormat, myfile2, False
End If

CurrentDb.Execute "UPDATE tblOwnerInfo " & _
"SET EmailDateState = Now() " & _
"WHERE OwnerID = " & lngID, dbFailOnError

Dim myitem As Object ' Outlook.MailItem
Dim myout As Object 'Outlook.Application
Set myout = CreateObject("Outlook.Application") ' New Outlook.Application
Set myitem = myout.CreateItem(0) '(olMailItem)
With myitem
.To = strMail
.CC = Nz(DLookup("EmailCC", "tblOwnerInfo", "OwnerID = " & lngID), "")
.Bcc = Nz(DLookup("EmailBCC", "tblOwnerInfo", "OwnerID = " & lngID), "")
.Subject = "Your Statement/Invoice" & " from " &
Nz(DLookup("[CompanyName]", "tblCompanyInfo"))
.Body = strBodyMsg
.Attachments.Add myfile1
If mytot > 0 Then
.Attachments.Add myfile2
End If

.Send

End With
Set myitem = Nothing
Set myout = Nothing
cbOwnerName.SetFocus

Case Else
Exit Sub

End Select
ExitProc:
Exit Sub


Resume ExitProc

End Sub
 
T

Tony Toews

Is it possible to alter my email code so as it can be used in the latest
Windows Verion , Windows7 "Windows Live"

As far as I know there is no programmible functionality in Microsoft
Outlook Express or Windows Live like there is for MS Outlook.

There are alternatives which use generic means such as SendObject
(which has many limitiations) and MAPI.

Microsoft Access Email FAQ
http://www.granite.ab.ca/access/email.htm

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
B

Bob Vance

Thanks Tony, Where would I start looking to change the code for Windows Live
and will any part of this code be able to be used for Windows Live
Regards Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top