Solved

outlook 2010 compatability

Posted on 2010-11-22
3
260 Views
Last Modified: 2012-05-10
The following code works in Outlook 2007. However in Outlook 2010 it does not work. No errors are produced. It is supposed to look through a users inbox and identify any e-mails with the text "Vizzihome" in the subject line and then split the body text into components.

In 2007, all the e-mails are picked up and split correctly. In 2010 none of the e-mails are picked up. Any thoughts ?
Dim mail_subject As String
Dim address_lines As Variant
ReDim address_lines_str(20) As String
Dim no_of_address As Long
Dim full_address As String
Dim Category As String


Dim j As Long
Dim r As Long
Dim p As Long
Dim str_len As Long
Dim hyperlink_pos As Long
Dim pos_of_postcode As Long
Dim postcode_area As String
Dim pos_of_full_stop As Long
Dim pos_of_Bedroom As Long
Dim next_row As Long
Dim pos_of_date As Long
Dim pos_of_Current_price As Long
Dim No_of_Bedrooms As String


r = 4


'* point to the name space
Set oNameSpace = Application.GetNamespace("MAPI")

'* set a reference to the inbox folder
Set oFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)

'* loop through the inbox

For Each oInboxItem In oFolder.Items


mail_subject = oInboxItem.Subject

pos_of_full_stop = check_source(mail_subject, ".")


If (check_source(mail_subject, "Vizzihome") > 0) And (pos_of_full_stop > 0) Then
    
    ReDim address_lines_str(20)

    
    
    address_lines = Split(oInboxItem.Body, "Address:")
    
    no_of_address = UBound(address_lines)
    
    
    'tidy up address lines
    
    
    
    For j = 0 To no_of_address
        
        Category = Right(mail_subject, Len(mail_subject) - pos_of_full_stop)
        
           'position of date
               
           pos_of_date = check_source(Category, "(")
        
          Reporting_Week = Right(Category, Len(Category) - pos_of_date)
          Reporting_Week = Left(Reporting_Week, Len(Reporting_Week) - 2)
          
          
         
         If pos_of_date > 0 Then
            Category = Left(Category, pos_of_date - 2)
         End If
         
        
                objWB.Sheets("sheet1").Range("d1").Value = Reporting_Week
        
        
        address_lines_str(j) = CStr(address_lines(j))
        
        
        'position of hyperlink
        
        hyperlink_pos = check_source(address_lines_str(j), "HYPERLINK")
        
        
        
        
        If hyperlink_pos > 0 Then
        
             r = r + 1
             
            'write out reporting week
            
            objWB.Sheets("sheet1").Range("a" & r).Value = Category
    
         
            
            'remove hyperlink
            
            address_lines_str(j) = Left(address_lines_str(j), hyperlink_pos - 1)
            
            objWB.Sheets("sheet1").Range("b" & r).Value = address_lines_str(j)
            
            'position of postcode
            
            pos_of_postcode = check_source(address_lines_str(j), "Postcode")
            
            full_address = Left(address_lines_str(j), pos_of_postcode - 3)
            
            objWB.Sheets("sheet1").Range("d" & r).Value = full_address
         
            address_lines_str(j) = Right(address_lines_str(j), Len(address_lines_str(j)) - pos_of_postcode + 1)
            
            pos_of_Bedroom = check_source(address_lines_str(j), "Bedroom")
            
            postcode_area = Left(address_lines_str(j), pos_of_Bedroom - 3)
                                    
            objWB.Sheets("sheet1").Range("k" & r).Value = postcode_area
                                                
            address_lines_str(j) = Right(address_lines_str(j), Len(address_lines_str(j)) - pos_of_Bedroom + 1)
            
            pos_of_Current_price = check_source(address_lines_str(j), "Current")
            
            No_of_Bedrooms = Left(address_lines_str(j), pos_of_Current_price - 3)
            
            
            objWB.Sheets("sheet1").Range("m" & r).Value = No_of_Bedrooms
        
            address_lines_str(j) = Right(address_lines_str(j), Len(address_lines_str(j)) - pos_of_Current_price + 1)
        
            objWB.Sheets("sheet1").Range("o" & r).Value = address_lines_str(j)
            
            
        End If
        
        
    Next j
    
 End If





Next

Open in new window

0
Comment
Question by:Kaps_68
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 250 total points
ID: 34196652
You might want to start by searching here:
http://www.outlookcode.com/
0
 
LVL 15

Expert Comment

by:Jeff Perkins
ID: 37693343
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question