Send Outlook Code

S

scott04

Hi everyone, I am looking for assistance in adding a line in my code.
Currently i have a button on a form that upon the click runs and query and
saves it on my desktop. I would like to add a line of code that would open
outlook and place the spreadsheet that was exported which is called DV.xls as
an attachment. Can anyone assist? The code I have is the following:
Private Sub cmdExportToExcel_Click ()
On Error GoTo ProcError
Dim strPath As String
strPath = CurrentProject.Path
DoCmd.OutputTo acOutputQuery, "Data Range Query for Email", acFormatXLS, _
strPath & "\DV.xls" ', AutoStart:=-1
MsgBox "The selected review requests have been exported to the " _
& "file DV.xls" & vbCrLf & "in the folder:" _
& vbCrLf & strPath, vbInformation, "Export Complete..."
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, , _
"Error in cmdExportToExcel_Click event procedure..."
Resume ExitProc
End Sub
 

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