Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

trying to resend a message if text in the subject is found

outlook 2010
access 2010  vba

vba in access 2010

I'm searching inside the "Inbox" on a certain namespace
if it finds the text in the subject,
I NEED TO RESEND THAT EMAIL MESSAGE

I get no errors but the emails are not sending.
I copied myself on the email, but i get no confirmation email ??




' trying for any mailbox under one profile here
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myInbox = myNameSpace.Folders("bookprice")
Set myInbox = myInbox.Folders("Inbox")
Set myitems = myInbox.Items


Found = False

' for this question purpose 
t =  "Action Required - Pricing Escalation #4414"
 

For Each myitem In myitems
    If myitem.Class = olMail Then
       ' If InStr(1, myitem.Subject, "Action Required - Pricing Escalation #4414") > 0 Then
        'If InStr(1, myitem.Subject, "" & t & "") > 0 Then
        If myitem.Subject = t > 0 Then
          
          'MsgBox "Found" '  Debug.Print "Found"
            Found = True
            
            
             ' run the resend command
             Set objInsp = myitem.GetInspector
             objInsp.CommandBars.ExecuteMso ("ResendThisMessage")
    
             ' get the opened compose message form & send it
           
  ' delete these lines if you don't need to auto-edit or to auto-send it
             Set olResendMsg = myitem    'ActiveInspector.CurrentItem 'Application.ActiveInspector.CurrentItem

           
             olResendMsg.Subject = "REMINDER: 2nd Request Please Respond : " & t & ""
             olResendMsg.BCC = "fredflintstone@xxxxxx.com"
             olResendMsg.Send

Open in new window



Thanks
fordraiders
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

why not simply create a "Rule" in your Outlook?

in the Rule Wizard, you can select:

1. With "something" in the subject or body

User generated image
2. forward it to people or public group

User generated image
Avatar of Fordraiders

ASKER

thanks for the suggestion.
but the query i'm using is specifically looking for  "Action Required - Pricing Escalation #4414
with this part "#4414" changing for each lookup.

If i could get the rule to span out 2 days that would work.

fordraiders
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks