This was the answer:
Sub SendReportAsSNP(PW As String, subj As String, text As String)
Dim appOutlook As New Outlook.Application
Dim itm As Outlook.MailItem
Dim strEMailRecipient As String
Dim strSnapshotFile As String
strSnapshotFile = <filepath and name>
'DoCmd.OutputTo ObjectType:=acOutputReport, _
objectname:=strReport, _
outputformat:=acFormatSNP, _
outputfile:=strSnapshotFile
'Create new mail message and attach snapshot file to it
Set itm = appOutlook.CreateItem(olMailItem)
With itm
.To = strEMailRecipient
.subject = subj
.Body = text
.Attachments.Add strSnapshotFile
.Send
End With
End Sub
Sarah said:
Sorry maybe someone else can help you.
Dennis said:
Error 2282:
The format in which you are attempting to output the current object is not
available.
Sarah said:
Type acFormatSNP and see if that works.
:
What number do I use for that? There's no "acFormatSnapshot" defined in VB.
:
Eventhough it doesn't show it as an option, try it anyways. I was able to
use this feature in Access 2000 specifying the Output format as Snaphot
Format.
:
Ahh, but Snapshot format is NOT one of the allowable Output Formats for that
command in Access 2002. Hence my problem...
:
The sendobject command can also be used in vba. You would specify Snapshot
Format for the Output Format. You can also use the macro to specify the To,
SUBJECT and BODY data. You would refer to a control in your form which
contains these values.
Example:
[Forms]![frmSend]![To]
[Forms]![frmSend]![Subject]
[Forms]![frmSend]![Body])
:
I'm triggering this via VBA. Can I pass the TO, SUBJECT and BODY data to the
macro?
:
Automate sending a report snapshot in e-mail
1. Create a macro.
2. Add the SendObject action to the macro. For example:
Argument: Value
Object Type: Report
Object Name: Summary of Sales by Quarter
Output Format: Snapshot Format
To: All Northwind Traders; Shareholders
Cc: none
Bcc: none
Subject: Quarterly Sales report
Message Text: This is our best quarter in years!
Edit Message: No
Run the macro each time you want to send the report snapshot.
Sarah
:
I need to use the VBA SendObject command to send an email containing an SNP
file (report). The options for that command do not show how I can specify the
SNP format.
How can I do that please?
Thanks!