Question : HELP!!!  email a .snp report....

I need to email (from within Access) a report to people on our network. I'd like to send the snapshot viewer with the .snp report, however I can't send (using SendObject method)the report as a .snp file type. I can save it as a .snp file, but how do you then send it via Outlook? How do you include the snapshot viewer in the same email as well? The report will always have the same name and will always be saved to the same folder. Is Access-Outlook automation the easiest way to do this?

Answer : HELP!!!  email a .snp report....

This seems to work perfectly.
Remember to reference Outlook.
When in design mode of a module, Select Tools, References and scroll down to Miscrosoft Outlook x.0 Object Library.

Sub cmdEmailSnapshot()
  '=============================================
  '     Purpose: E-Mail Graph - Converted to snapshot sender
  '      E-Mail: [email protected]
  '  Programmer: Graeme Wilson
  '  Edited/Changed: Trygve
  '=============================================
On Error GoTo cmdEmailSnapshot_Err
    Dim strErrMsg As String 'For Error Handling
    Dim olApp As New Outlook.Application
    Dim olNameSpace As Outlook.NameSpace
    Dim olMail As Outlook.MailItem
    Dim strFileName As String
    Dim strViewerPath As String
   
Set olNameSpace = olApp.GetNamespace("MAPI")
Set olMail = olApp.CreateItem(olMailItem)

strFileName = "c:\ETPMVM_Demo_None_.snp"
strViewerPath = "c:\misc\install\tools\snpvw80.exe"

With olMail
    .To = "[email protected]"
    .Subject = "Snapshot report " & Format(Now(), "dd mmm yyyy  hh:mm")
    .Attachments.Add strFileName ' The snapshot file
    .Attachments.Add strViewerPath ' The viewer.
    .ReadReceiptRequested = False
    .Send
End With

Msgbox vbCrLf & "Snapshot report has been E-Mailed", _
        vbInformation + vbOKOnly, "Chart Exported :"


cmdEmailSnapshot_Exit:
Set olApp = Nothing
Set olMail = Nothing
    Exit Sub

cmdEmailSnapshot_Err:
    Select Case Err
        Case Else
            strErrMsg = strErrMsg & "Error #: " & Format$(Err.Number) & vbCrLf & vbCrLf
            strErrMsg = strErrMsg & "Error Description: " & Err.Description & vbCrLf
            Msgbox strErrMsg, vbInformation, "cmdEmailSnapshot"
            Resume cmdEmailSnapshot_Exit
    End Select

End Sub
Random Solutions  
 
programming4us programming4us