J
JC
Help new at functions-
Have
..Form![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
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
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
'Set StrCC = [Form]![e_mailAddress]
'Set ActiveControl = e_mailAddress
'Me.ActiveControl = e_mailAddress
'Set olCC = [Approver].Form![e-mailAddress]
'Set olCC = [Approver].Form![e-mailAddress]
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
Set objOutlookRecip = .Recipients.Add(CC)
objOutlookRecip.Type = olCC
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
need to specify form link for field in form for cc option
[Approver].Form![e-mailAddress] anyone have any ideas.
Have
..Form![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
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
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
'Set StrCC = [Form]![e_mailAddress]
'Set ActiveControl = e_mailAddress
'Me.ActiveControl = e_mailAddress
'Set olCC = [Approver].Form![e-mailAddress]
'Set olCC = [Approver].Form![e-mailAddress]
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
Set objOutlookRecip = .Recipients.Add(CC)
objOutlookRecip.Type = olCC
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
need to specify form link for field in form for cc option
[Approver].Form![e-mailAddress] anyone have any ideas.