does anyone know how to send a form as an attachment using this code?
Option Compare Database
Sub sbSendMessage(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutLookMsg As Outlook.MailItem
Dim objOutLookRecip As Outlook.Recipient
'Dim objOutlookAttach As Outlook.Attachment
Dim stDocName As String
Dim toField As String
On Error GoTo errmsgs
stDocName = "Email_Ticket"
'toField = (Form_HelpDesk!First_Name & " " & Form_HelpDesk!Last_Name)
toField = "Brandie Willis"
Set objOutlook = CreateObject("Outlook.Application")
Set objOutLookMsg = objOutlook.CreateItem(olMailItem)
With objOutLookMsg
'recipients
Set objOutLookRecip = .Recipients.Add(toField)
objOutLookRecip.Type = olTo
'Set objOutLookRecip = .Recipients.Add("me.First_Name, me.Last_Name")
'objOutLookRecip.Type = olBCC
'subject
.Subject = "IT STAFF Trouble Ticket"
'body
.Body = "The Attachment Contains the Details of your Trouble Ticket" & vbCrLf & vbCrLf
'attachmentas
'.Attachments.Add
'importance
.Importance = olImportanceHigh
'resolve recipient name
For Each objOutLookRecip In .Recipients
If objOutLookRecip.Resolve Then
objOutLookMsg.Display
End If
Next
.Send
End With
Set objOutLookMsg = Nothing
Set objOutlook = Nothing
Set objOutLookRecip = Nothing
Set objOutlookAttach = Nothing
errmsgs:
If Err.Number = "287" Then
MsgBox "You Clicked NO to the Outlook Security Warning. " & _
"Return the Procedure and Click YES to access e-mail" & _
"Address to Send Your Message." _
Or MsgBox(Err.Description, Err.HelpContext, Err.Number)
Else
'MsgBox "Your Message was successfully Sent"
MsgBox Err.Description, Err.Number, Err.HelpContext
End If
End Sub
sorry if it is so rough, i am still working out the kinks
any help would be awsome
thanks
Option Compare Database
Sub sbSendMessage(Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutLookMsg As Outlook.MailItem
Dim objOutLookRecip As Outlook.Recipient
'Dim objOutlookAttach As Outlook.Attachment
Dim stDocName As String
Dim toField As String
On Error GoTo errmsgs
stDocName = "Email_Ticket"
'toField = (Form_HelpDesk!First_Name & " " & Form_HelpDesk!Last_Name)
toField = "Brandie Willis"
Set objOutlook = CreateObject("Outlook.Application")
Set objOutLookMsg = objOutlook.CreateItem(olMailItem)
With objOutLookMsg
'recipients
Set objOutLookRecip = .Recipients.Add(toField)
objOutLookRecip.Type = olTo
'Set objOutLookRecip = .Recipients.Add("me.First_Name, me.Last_Name")
'objOutLookRecip.Type = olBCC
'subject
.Subject = "IT STAFF Trouble Ticket"
'body
.Body = "The Attachment Contains the Details of your Trouble Ticket" & vbCrLf & vbCrLf
'attachmentas
'.Attachments.Add
'importance
.Importance = olImportanceHigh
'resolve recipient name
For Each objOutLookRecip In .Recipients
If objOutLookRecip.Resolve Then
objOutLookMsg.Display
End If
Next
.Send
End With
Set objOutLookMsg = Nothing
Set objOutlook = Nothing
Set objOutLookRecip = Nothing
Set objOutlookAttach = Nothing
errmsgs:
If Err.Number = "287" Then
MsgBox "You Clicked NO to the Outlook Security Warning. " & _
"Return the Procedure and Click YES to access e-mail" & _
"Address to Send Your Message." _
Or MsgBox(Err.Description, Err.HelpContext, Err.Number)
Else
'MsgBox "Your Message was successfully Sent"
MsgBox Err.Description, Err.Number, Err.HelpContext
End If
End Sub
sorry if it is so rough, i am still working out the kinks
any help would be awsome
thanks