![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Far too frequently I send an e-mail to someone and I forget something,
so I send them another e-mail. I usually go to my sent items folder and hit "Reply" so that the new e-mail has the old text in it. When I do this in gmail, it knows I want to send the reply to the original addressee. When I do this in Outlook 2007, it makes the reply out to me. This is not desired and it annoys me to have to copy and paste the text I just wrote into a new, readdressed e-mail. However, for some reason the e-mail is still addressed to me, BUT gets sent to the desired recipient with my name in the "To:" field! This is wierd and this is where I need help. To test my code you will need someone else you can send e-mails to. Put this code in, then send them one e-mail, then go to your sent folder, reply to that message, and hit send to activate my code. It's wierd! This all boils down to one big question: 1) How do I get it to actually change the text of who it is sending it to as it sends it? ....with a few side questions if you're feeling extra helpful: 2) How do I reset the Recipients collection so I'm not a part of it 3) Can I get this event to trigger when I first create the reply, not just at the last minute when I send it? 4) My code is currently in a module(?) called "ThisOutlookSession". Will this save and work between sessions? If not, will inserting a new module fix that? Thank you for your attention and possible help, ~J Finally my code: Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) On Error GoTo Err_ItemSend Dim objRecipient As Recipient 'STEP 1. Checks to see if the message is a reply (by seeing if the subject has "") 'Is there a better way to do this? If UCase(Left(Item.Subject, 3)) = "" Then 'STEP 2. Checks to see if the recipients are only myself Dim strRecipients As String strRecipients = "" For Each objRecipient In Item.Recipients strRecipients = strRecipients & objRecipient.Name & ";" Next If strRecipients = "MyLastName, MyFirstName;" Then 'Is there a way to not hardcode my name so it works for anyone? 'STEP 3. Looks up the text of who the message is REALLY to 'is there a better way to do this than searching the body text? Dim intCursor As Integer intCursor = InStr(Item.Body, "To: ") + 4 If intCursor 4 Then strRecipients = Mid(Item.Body, intCursor, 20) intCursor = InStr(strRecipients, vbCr) - 1 If intCursor = 0 Then strRecipients = InStr(strRecipients, ";") - 1 End If Debug.Print strRecipients & " : " & intCursor If intCursor 0 Then strRecipients = Left(strRecipients, intCursor) Select Case MsgBox("Send message to " & strRecipients & "?", vbYesNoCancel) Case vbYes: 'STEP 4. Adds the real recipient to the list 'STEP 5. Continue with the send Dim objMe As Recipient Set objMe = Item.Recipients.Add(strRecipients) objMe.Type = olBCC objMe.Resolve Set objMe = Nothing Case vbNo: If MsgBox("Send item to yourself?", vbYesNo) = vbNo Then Cancel = True Case Else: Cancel = True End Select End If End If End If End If Exit_ItemSend: Set objRecipient = Nothing Exit Sub Err_ItemSend: MsgBox "There was an error while checking if your e-mail was a reply to yourself." & vbCr & Err.Number & " - " & Err.Description Resume Exit_ItemSend End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Make "all day event" an "all workday event" by default. | Michael Arm | Outlook - Calandaring | 0 | August 5th 06 10:21 PM |
Using "Send to mail recipient" doesn't work - Outlook 2003 | [email protected] | Outlook - General Queries | 6 | July 9th 06 12:49 AM |
How to set default for all-day event to indicate "busy" not "free. | Shuggles | Outlook - Calandaring | 1 | July 6th 06 12:45 PM |
Please help "None of your e-mail accounts could send to this recipient." | charlied | Outlook - General Queries | 0 | February 13th 06 09:35 PM |
how to implement "itemsend" with vc++6.0 | Ram | Add-ins for Outlook | 1 | January 28th 06 10:22 PM |