1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Need Outlook script

Discussion in 'Business Applications' started by bigtalker, Nov 6, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. bigtalker

    bigtalker Thread Starter

    Joined:
    Aug 1, 2007
    Messages:
    4
    Outlook 2003 on Win2K

    I receive emails that I filter into a specific folder. These emails include a link to an unique URL that I must click to verify I have received the specific email.

    How would I create a script to call from my Outlook rules to automate this process to unconditionally click the link as soon as the email hits the specific folder?

    Thanks in advance
     
  2. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    I don't think this can be processed automatically through Outlook rules. You may be able to use some VBA (Visual Basic for Applications) to accomplish this. The code would fire on the new mail event in Outlook and check each email for a hyperlink and take action. Does the link show target path?


    Regards,
    Rollin
     
  3. bigtalker

    bigtalker Thread Starter

    Joined:
    Aug 1, 2007
    Messages:
    4
    Thanks, Rolloi. I sent you an email about this as well.

    Here is the body of a typical email. The link is unique for each email

    Thanks for your attention

    Bigtalker

    ++++++++++++++++++++++++++++++
    Please note that a Installation (SR9999999) located in zip XXXXX has been tentatively scheduled for Friday, 11/09/2007 with an arrival window of 13:00 to 17:00. To confirm this appointment, please click the link below, or feel free to call XXX at 1.800.999.9999.

    http://esp.xxxxxxxxxxxxxxxx.com/con...?key=MTI0NjQxMjAuNjY5MjcyMDAgMTE5NDIwNTYxOA==

    Thank you,
     
  4. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    Open Outlook and press ATL + F11 to open the VB editor. One the left hand side of editor there will be a small project explorer window. Locate the object/folder called Microsoft Office Outlook Objects and click on the plus sign (+) and expand the object if needed. Look for the item labeled ThisOutlookSession and right click it and select VIEW CODE. When the blank code module opens up copy and paste the code below into it and save the application. Just change the folder path where I have commented in the code and also make sure Macros are enabled in Outlook. Make sure to turn your rule off since the code has logic to move the message already.

    Code:
    Dim objMapiName As Outlook.NameSpace
    Dim oIE As Object
    
    Set oIE = CreateObject("InternetExplorer.Application")
    oIE.Visible = True
    
    Set objMapiName = Application.GetNamespace("MAPI")
    Set vFolder = objMapiName.Folders("Personal Folders").Folders("Inbox").Folders("Test")
    
    '****************************************************
    'CHANGE THE DESTINATION FOLDER PATH IN THE LINE BELOW
    '****************************************************
    
    Set myDestFolder = objMapiName.Folders("Personal Folders").Folders("Inbox").Folders("Endeavor")
    
    'YOU COULD ALSO DRILL DOWN FURTHER INTO A DEEPER FOLDER PATH
    'Set myDestFolder = objMapiName.Folders("Personal Folders").Folders("Endeavor").Folders("New Vonage Sked")
    
    LoopItems:
    
    For i = 1 To vFolder.Items.Count
    
    If vFolder.Items.Count = 0 Then
    
    End
    
    End If
     
    Set myItem = vFolder.Items.Item(i)
    
    If Trim(myItem.Subject) = "Vonage Schedule Notification" Then
    
    myItem.UnRead = False
    
    myItem.Move myDestFolder
    
    i = i - 1
    
    vString = Mid(myItem.Body, InStr(1, myItem.Body, "http:"), Len(myItem.Body))
    
    vLink = Left(vString, InStr(1, vString, "Thank") - 1)
    
    oIE.Navigate (vLink)
    
    Do While oIE.busy
    Loop
    
    End If
    
    Next i
    
    oIE.Quit
    
    Set oIE = Nothing
    Set objMapiName = Nothing
    Set vFolder = Nothing
    Set myDestFolder = Nothing
     
  5. bigtalker

    bigtalker Thread Starter

    Joined:
    Aug 1, 2007
    Messages:
    4
    Thanks, bunches, Rollin'

    Works great and I also get a quick intro to VB macros!!

    Your efforts in support of users of these forums are heroic.
     
  6. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    Feel free to Mark this problem as SOLVED by using the thread tools at the top of the page. Are you able to verify that the links have been opened correctly by the code? The code is designed to loop through each item in the Inbox and check for the subject line of your choice. This code may be inefficient if you have thousands of items in your Inbox. If the processing time seems to long or memory intensive just let me know and we'll come up with a work-around for you.

    Regards,
    Rollin
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/648456

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice