PC Review


Reply
Thread Tools Rate Thread

Appending The Subject Line In A Forwarded Message, Office 2007

 
 
New Member
Join Date: Nov 2011
Location: North of Detroit, MI
Posts: 2
 
      28th Nov 2011
I created a Form in MS Outlook that allows the user to request time off (leave). They fill in the required information (employee ID number, name, dates to be taken, address, etc.) and then send it to their supervisor. If their supervisor has authority to grant the leave then the form is approved and a copy is sent to the personnel office.

If the supervisor is required to send the request to a higher level supervisor, then it is forwarded using either an "Approved and Forwarded" action or "Rejected and Forwarded" action.

The subject line of this email is populated with the words and data, "Leave Request", employee's name, the date the leave begins and the date the leave ends

When the request is forwarded to the higher level supervisor, I would like for the subject line to be appended with wording to the effect of, "Approved and Forwarded" or "Rejected and Forwarded", along with the information already there.

I found an example that uses a Select Case statement and modified it to what I thought would meet my needs but it will not add the required verbage.

This is the code that I found
Code:
Function Item_CustomAction(ByVal Action, ByVal NewItem)
Select Case Action.Name
        Case "Approve and forward to next in chain of command"
            MsgBox "Please Send To Your Supervisor"
            Item.Body = My10Value
 End Select
End Function
This is the entire code that I am using
Code:
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem) 

Function Item_Send()
    MyValue = Item.UserProperties("Have Replies Sent To")
    My2Value = Item.UserProperties("Name")
    My3Value = Item.UserProperties("frmBeginLeave")
    My4Value = Item.UserProperties("frmEndLeave")
    My5Value = Item.UserProperties("Date")
    My6Value = Item.UserProperties("EmployeeID")
    My7Value = Item.UserProperties("LeaveAddress")
    My8Value = Item.UserProperties("Request")
    My9Value = Item.UserProperties("RequestNotes")
    My12Value = Item.UserProperties("LeaveToBeCharged")
    SubjValue = Item.UserProperties("Subject")
    date1 = Instr(4,My3Value,"/")
    datea1 = Mid(My3Value,1,date1+4)
    date2 = Instr(4,My4Value,"/")
    dateb2 = Mid(My4Value,1,date2+4)
    My10Value  = "Requestor: " & MyValue & VbLf & "Employee ID: " &  My6Value & VbLf & "Begin Date: " & datea1 & VbLf &  "End Date: " & dateb2 & VbLf & "Leave To Be Charged: " &  My12Value & VbLf & "Leave Address: " & My7Value & VbLf  & VbLf & My9Value & VbLf & "*** *** *** *** ***" &  VbLf & VbLf
    My11Value = MyValue
    Item.UserProperties("Request").Value = My10Value
    Item.UserProperties("Have Replies Sent To").Value = My11Value
    Item.Body = My10Value
End Function

Function Item_CustomAction(ByVal Action, ByVal NewItem)
Select Case Action.Name
        Case "Approve and forward to next in chain of command"
            Item.Subject = "Approved and forwarded: " & SubjValue
 End Select
End Function
I also tried substituting the Select Case section with this but no luck either
Code:
Function Item_Forward(ByVal ForwardItem)
    Select Case Action.Name
        Case "Approve and forward to next in chain of command"
        Item.Subject = "Approved and forwarded: " & SubjValue
    End Select
End Function
Any ideas?

Kevin
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:01 PM.