Hello,
I have been able to send emails and send attachments if the path is static, but I am looking to create a browse function to attach items to the email. So far my code is...
for the selection of files:
and for the adding selected attachment to the email:
so far I can get the email to send without attachments and I can attach using ".Attachments.add" and then stating the name of the file to add, but I need to be able to add attachments that the user selects.
Any help would be greatly appreciated!
I have been able to send emails and send attachments if the path is static, but I am looking to create a browse function to attach items to the email. So far my code is...
for the selection of files:
Code:
Dim f As Office.FileDialog
Set f = Application.FileDialog(msoFileDialogFilePicker)
f.AllowMultiSelect = True
If f.Show Then
MsgBox f.SelectedItems.Count & " file(s) were chosen."
Dim i As Integer
For i = 1 To f.SelectedItems.Count
MsgBox f.SelectedItems(i)
Next i
End If
and for the adding selected attachment to the email:
Code:
With oMail
.To = Email
.Subject = Subject
.Body = Body
For i = 1 To f.SelectedItems.Count
.Attachments.Add = """f.SelectedItems(i)"""
Next i
.Display
End With
so far I can get the email to send without attachments and I can attach using ".Attachments.add" and then stating the name of the file to add, but I need to be able to add attachments that the user selects.
Any help would be greatly appreciated!