Hello,
I am currently in the process of creating a form that will allow you to enter details for an email sent, select a number of documents from a list box and then open the mail message pre-written with attachments. The attachments reside in a list box currently, and I am attempting to use a "For Each" with item selected.column(3) as the file path, as column(3) contains the filepath from the table.
Currently my code is:
When this code runs, outlook will open as a process when it is closed, but then freeze and not allow me to see it or access it in anyway. If Outlook is opened Microsoft office usually gets angry at me and decides to throw error messages at me.
I was wondering if anyone could help out with this code, as my project is nearly finished and it would be a huge relief!
Thanks
I am currently in the process of creating a form that will allow you to enter details for an email sent, select a number of documents from a list box and then open the mail message pre-written with attachments. The attachments reside in a list box currently, and I am attempting to use a "For Each" with item selected.column(3) as the file path, as column(3) contains the filepath from the table.
Currently my code is:
Code:
Private Sub OutlookBut_Click()
Dim olApp As Object
Dim objMail As Object
Dim varItm As Variant
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If Err Then
Set olApp = CreateObject("Outlook.Application")
End If
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.To = Me.Email
.Subject = Me.Subject
.CC = Me.CC
.BCC = Me.BCC
For Each varItm In Me.AttachBox.ItemsSelected
.Attachments = Me.AttachBox.Column(3)
Next varItm
End With
End Sub
When this code runs, outlook will open as a process when it is closed, but then freeze and not allow me to see it or access it in anyway. If Outlook is opened Microsoft office usually gets angry at me and decides to throw error messages at me.
I was wondering if anyone could help out with this code, as my project is nearly finished and it would be a huge relief!
Thanks