I am having difficulty with this one module. It is supposed to attach a spreadsheet and then allow the user to finish filling out the Outlook form before sending it.
The problem seems to be that the attachment is arriving corrupted.
Does anyone have any answers?
The problem seems to be that the attachment is arriving corrupted.
Does anyone have any answers?
Code:
Private Sub Form_Open(Cancel As Integer)
Set MyOlApp = CreateObject("Outlook.Application")
End Sub
Sub AddAttachment(TMail)
Dim myItem As Object 'Outlook.MailItem
Set myItem = MyOlApp.CreateItem(olMailItem)
myItem.To = TMail
myItem.Subject = "Weekly Open Requisition Report"
myItem.Attachments.Add "C:\OpenRequisitions.XLS", olByValue, 1, "OpenRequisitions"
myItem.Body = "Attached is your open requisition report. Please note this includes all lines of business. If you have any questions, contact the assigned recruiter." & vbCrLf & "Thank You"
myItem.Display
End Sub
Private Sub Form_Close()
MyOlApp.Quit
End Sub