I haven't used the code provided; I wrote that in the first sentence.
I do have Outlook code, and to send mail one needs to replace .Display
with .Send in the with area. This code will allow attachments:
Sub RequestAccess()
Dim objOutlookApp As Object
Dim objOutlookMail As Object
Set objOutlookApp = CreateObject("Outlook.Application")
Set objOutlookMail = objOutlookApp.CreateItem(0)
Dim strRecipients As String
Dim CurrentUser As String
strRecipients = "[Put you recipients here]"
With objOutlookMail
.To = strRecipients
.Subject = "Request..."
.Display
End With
'releases resources from outlook and associated components
If Not objOutlookApp Is Nothing Then
objOutlookApp.Quit
If Not objOutlookMail Is Nothing Then
Set objOutlookMail = Nothing
End If
Set objOutlookApp = Nothing
End If
Exit Sub
ErrorTrap:
MsgBox Err.Number & " : " & Err.Description, vbOKOnly, "Error"
'releases resources from outlook and associated components
If Not objOutlookApp Is Nothing Then
objOutlookApp.Quit
If Not objOutlookMail Is Nothing Then
Set objOutlookMail = Nothing
End If
Set objOutlookApp = Nothing
End If
End Sub
Hi James
I have a code to automate using Outlook Express but I can't seem to be able
to set attachments. Does you code allow you to set attachments?
Thanks and regards
Richard