message send options code- help

J

JC

I have a mail message coded in access but I need to setup the message send
options similar to what I have

Dim strEmailMessage As String
Dim strCC As String
Dim StrRcvdDate As String
Dim strDueDate As String
Dim StrSubject As String
Dim StrImportance As String -tried doesn't work


so that I could fill in what I need like I did with the subject line
StrSubject = "Manual Billing Request. Adjustment Form"

can someone please tell me how to reference the outlook message options
the importance and sensitivity level
Track messages and replies
the voting options
assign a keyword

Set delivery options
 
J

JC

Coworker found fnctoutlook in another site that allows the man ipulation of
outlook a little better the code though is hard to follow
you have the function and then you have to call the function
manipulating the function itself is not easy
==================================
Private Sub CmdSendEmail_Click()
fctnOutlook
'fctnOutlook , "(e-mail address removed)", Forms!Approver.[e_mailAddress],
"Medco Finance Contracts Admin", "Manual Billing Request. Adjustment Form",
"Please review the attached document, Approve or Reject by Email. Please
email Medco Finance Contracts Admin the revised Form." & Chr(10) & Chr(10) &
"Thank you!" & Chr(10) & Chr(10) & "Adjustment Administrator" & Chr(10) &
Chr(10), "Billing Request Adjustment",
"S:\Finance\FISD\Adjustments\Snapshots\data.snp", "Approved; Rejected", 2,
True
'fctnOutlook , Forms!Approver.[e_mailAddress], , , , "Medco Finance
Contracts Admin", "Manual Billing Request. Adjustment Form", "Please review
the attached document, Approve or Reject by Email. Please email Medco Finance
Contracts Admin the revised Form." & Chr(10) & Chr(10) & "Thank you!" &
Chr(10) & Chr(10) & "Adjustment Administrator" & Chr(10) & Chr(10), "Billing
Request Adjustment", "S:\Finance\FISD\Adjustments\Snapshots\data.snp",
"Approved; Rejected", 2, True


End Sub


===================================
Function fctnOutlook(Optional FromAddr, Optional Addr, Optional CC, Optional
CC1, Optional CC2, Optional CC3, Optional BCC, _
Optional Subject, Optional MessageText, Optional Categories, Optional
AttachmentPath, Optional Vote As String = vbNullString, _
Optional Urgency As Byte = 1, Optional EditMessage As Boolean = True)


Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
'Dim StrCC As String

'Create the Outlook Session
Set objOutlook = CreateObject("Outlook.Application")
'Create the message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)


'StrCC = Me.e_mailAddress

'Add the Recipients to the message above
With objOutlookMsg

If Not IsMissing(FromAddr) Then
.SentOnBehalfOfName = FromAddr
End If

If Not IsMissing(Addr) Then
Set objOutlookRecip = .Recipients.Add(Addr)
objOutlookRecip.Type = olTo
End If

If Not IsMissing(CC) Then
'DoCmd.GoToControl.Forms!Approver.[e_mailAddress]
'DoCmd.GoToRecord , , acNext
Set objOutlookRecip = .Recipients.Add(CC)
objOutlookRecip.Type = olCC
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC1)
objOutlookRecip.Type = olCC1
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC2)
objOutlookRecip.Type = olCC2
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC3)
objOutlookRecip.Type = olCC3
End If
If Not IsMissing(BCC) Then
Set objOutlookRecip = .Recipients.Add(BCC)
objOutlookRecip.Type = olBCC
End If

If Not IsMissing(Subject) Then
.Subject = Subject
End If

If Not IsMissing(MessageText) Then
.Body = MessageText
End If

If Not IsMissing(Categories) Then
.Categories = Categories
End If

If Not IsMissing(AttachmentPath) Then
'Check file exists before attaching!
If Len(Dir(AttachmentPath)) > 0 Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
Else
MsgBox "Attachment not found.", vbExclamation
End If
End If

If IsNull(Vote) = False Then
.VotingOptions = Vote
End If

Select Case Urgency
Case 2
.Importance = olImportanceHigh
Case 0
.Importance = olImportanceLow
Case Else
.Importance = olImportanceNormal
End Select

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next

If EditMessage Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing

End Function
 
J

JC

My issue now is how do I get this code to work with the form
Forms!Approver.[e_mailAddress] and the multiple records in the form?

JC said:
Coworker found fnctoutlook in another site that allows the man ipulation of
outlook a little better the code though is hard to follow
you have the function and then you have to call the function
manipulating the function itself is not easy
==================================
Private Sub CmdSendEmail_Click()
fctnOutlook
'fctnOutlook , "(e-mail address removed)", Forms!Approver.[e_mailAddress],
"Medco Finance Contracts Admin", "Manual Billing Request. Adjustment Form",
"Please review the attached document, Approve or Reject by Email. Please
email Medco Finance Contracts Admin the revised Form." & Chr(10) & Chr(10) &
"Thank you!" & Chr(10) & Chr(10) & "Adjustment Administrator" & Chr(10) &
Chr(10), "Billing Request Adjustment",
"S:\Finance\FISD\Adjustments\Snapshots\data.snp", "Approved; Rejected", 2,
True
'fctnOutlook , Forms!Approver.[e_mailAddress], , , , "Medco Finance
Contracts Admin", "Manual Billing Request. Adjustment Form", "Please review
the attached document, Approve or Reject by Email. Please email Medco Finance
Contracts Admin the revised Form." & Chr(10) & Chr(10) & "Thank you!" &
Chr(10) & Chr(10) & "Adjustment Administrator" & Chr(10) & Chr(10), "Billing
Request Adjustment", "S:\Finance\FISD\Adjustments\Snapshots\data.snp",
"Approved; Rejected", 2, True


End Sub


===================================
Function fctnOutlook(Optional FromAddr, Optional Addr, Optional CC, Optional
CC1, Optional CC2, Optional CC3, Optional BCC, _
Optional Subject, Optional MessageText, Optional Categories, Optional
AttachmentPath, Optional Vote As String = vbNullString, _
Optional Urgency As Byte = 1, Optional EditMessage As Boolean = True)


Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
'Dim StrCC As String

'Create the Outlook Session
Set objOutlook = CreateObject("Outlook.Application")
'Create the message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)


'StrCC = Me.e_mailAddress

'Add the Recipients to the message above
With objOutlookMsg

If Not IsMissing(FromAddr) Then
.SentOnBehalfOfName = FromAddr
End If

If Not IsMissing(Addr) Then
Set objOutlookRecip = .Recipients.Add(Addr)
objOutlookRecip.Type = olTo
End If

If Not IsMissing(CC) Then
'DoCmd.GoToControl.Forms!Approver.[e_mailAddress]
'DoCmd.GoToRecord , , acNext
Set objOutlookRecip = .Recipients.Add(CC)
objOutlookRecip.Type = olCC
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC1)
objOutlookRecip.Type = olCC1
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC2)
objOutlookRecip.Type = olCC2
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC3)
objOutlookRecip.Type = olCC3
End If
If Not IsMissing(BCC) Then
Set objOutlookRecip = .Recipients.Add(BCC)
objOutlookRecip.Type = olBCC
End If

If Not IsMissing(Subject) Then
.Subject = Subject
End If

If Not IsMissing(MessageText) Then
.Body = MessageText
End If

If Not IsMissing(Categories) Then
.Categories = Categories
End If

If Not IsMissing(AttachmentPath) Then
'Check file exists before attaching!
If Len(Dir(AttachmentPath)) > 0 Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
Else
MsgBox "Attachment not found.", vbExclamation
End If
End If

If IsNull(Vote) = False Then
.VotingOptions = Vote
End If

Select Case Urgency
Case 2
.Importance = olImportanceHigh
Case 0
.Importance = olImportanceLow
Case Else
.Importance = olImportanceNormal
End Select

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next

If EditMessage Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing

End Function



JC said:
I have a mail message coded in access but I need to setup the message send
options similar to what I have

Dim strEmailMessage As String
Dim strCC As String
Dim StrRcvdDate As String
Dim strDueDate As String
Dim StrSubject As String
Dim StrImportance As String -tried doesn't work


so that I could fill in what I need like I did with the subject line
StrSubject = "Manual Billing Request. Adjustment Form"

can someone please tell me how to reference the outlook message options
the importance and sensitivity level
Track messages and replies
the voting options
assign a keyword

Set delivery options
 
J

JC

Thought of putting in a counter field
to use with for next Loop



Dim stDocName As String
Dim stLinkCriteria As String
Dim Count As Integer


stDocName = "Approver"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNext
' 'Set N = Count
For i = 1 To 1
If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC)
objOutlookRecip.Type = olCC
End If
Next i



JC said:
My issue now is how do I get this code to work with the form
Forms!Approver.[e_mailAddress] and the multiple records in the form?

JC said:
Coworker found fnctoutlook in another site that allows the man ipulation of
outlook a little better the code though is hard to follow
you have the function and then you have to call the function
manipulating the function itself is not easy
==================================
Private Sub CmdSendEmail_Click()
fctnOutlook
'fctnOutlook , "(e-mail address removed)", Forms!Approver.[e_mailAddress],
"Medco Finance Contracts Admin", "Manual Billing Request. Adjustment Form",
"Please review the attached document, Approve or Reject by Email. Please
email Medco Finance Contracts Admin the revised Form." & Chr(10) & Chr(10) &
"Thank you!" & Chr(10) & Chr(10) & "Adjustment Administrator" & Chr(10) &
Chr(10), "Billing Request Adjustment",
"S:\Finance\FISD\Adjustments\Snapshots\data.snp", "Approved; Rejected", 2,
True
'fctnOutlook , Forms!Approver.[e_mailAddress], , , , "Medco Finance
Contracts Admin", "Manual Billing Request. Adjustment Form", "Please review
the attached document, Approve or Reject by Email. Please email Medco Finance
Contracts Admin the revised Form." & Chr(10) & Chr(10) & "Thank you!" &
Chr(10) & Chr(10) & "Adjustment Administrator" & Chr(10) & Chr(10), "Billing
Request Adjustment", "S:\Finance\FISD\Adjustments\Snapshots\data.snp",
"Approved; Rejected", 2, True


End Sub


===================================
Function fctnOutlook(Optional FromAddr, Optional Addr, Optional CC, Optional
CC1, Optional CC2, Optional CC3, Optional BCC, _
Optional Subject, Optional MessageText, Optional Categories, Optional
AttachmentPath, Optional Vote As String = vbNullString, _
Optional Urgency As Byte = 1, Optional EditMessage As Boolean = True)


Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
'Dim StrCC As String

'Create the Outlook Session
Set objOutlook = CreateObject("Outlook.Application")
'Create the message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)


'StrCC = Me.e_mailAddress

'Add the Recipients to the message above
With objOutlookMsg

If Not IsMissing(FromAddr) Then
.SentOnBehalfOfName = FromAddr
End If

If Not IsMissing(Addr) Then
Set objOutlookRecip = .Recipients.Add(Addr)
objOutlookRecip.Type = olTo
End If

If Not IsMissing(CC) Then
'DoCmd.GoToControl.Forms!Approver.[e_mailAddress]
'DoCmd.GoToRecord , , acNext
Set objOutlookRecip = .Recipients.Add(CC)
objOutlookRecip.Type = olCC
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC1)
objOutlookRecip.Type = olCC1
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC2)
objOutlookRecip.Type = olCC2
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC3)
objOutlookRecip.Type = olCC3
End If
If Not IsMissing(BCC) Then
Set objOutlookRecip = .Recipients.Add(BCC)
objOutlookRecip.Type = olBCC
End If

If Not IsMissing(Subject) Then
.Subject = Subject
End If

If Not IsMissing(MessageText) Then
.Body = MessageText
End If

If Not IsMissing(Categories) Then
.Categories = Categories
End If

If Not IsMissing(AttachmentPath) Then
'Check file exists before attaching!
If Len(Dir(AttachmentPath)) > 0 Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
Else
MsgBox "Attachment not found.", vbExclamation
End If
End If

If IsNull(Vote) = False Then
.VotingOptions = Vote
End If

Select Case Urgency
Case 2
.Importance = olImportanceHigh
Case 0
.Importance = olImportanceLow
Case Else
.Importance = olImportanceNormal
End Select

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next

If EditMessage Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing

End Function



JC said:
I have a mail message coded in access but I need to setup the message send
options similar to what I have

Dim strEmailMessage As String
Dim strCC As String
Dim StrRcvdDate As String
Dim strDueDate As String
Dim StrSubject As String
Dim StrImportance As String -tried doesn't work


so that I could fill in what I need like I did with the subject line
StrSubject = "Manual Billing Request. Adjustment Form"

can someone please tell me how to reference the outlook message options
the importance and sensitivity level
Track messages and replies
the voting options
assign a keyword

Set delivery options
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top