INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Automation

Name/Address Parsing Outlook OOP-Style by craigsboyd
Posted: 1 Apr 05

Cut & Paste the code below into a PRG in VFP and execute it to see this run. - Craig Boyd

CODE

**********************************************
*
*    Sample code using clsOutlookParser
*
**********************************************
CLEAR

LOCAL loParser
loParser = CREATEOBJECT("clsOutlookParser")

loParser.FullName = "Dr. William T. Van Essen Sr."
loParser.Address = "315 SW 3rd Street" + CHR(13) + "Pipestone, MN 56164"
? "Title: " + loParser.Title
? "First Name: " + loParser.FirstName
? "Middle Name: " + loParser.MiddleName
? "Last Name: " + loParser.LastName
? "Suffix Name: " + loParser.Suffix
? "Last Comma First: " + loParser.LastNameAndFirstName
? "Initials: " + loParser.Initials
? "Street: " + loParser.Street
? "PostOfficeBox: " + loParser.PostOfficeBox
? "City: " + loParser.City
? "State: " + loParser.State
? "PostalCode: " + loParser.PostalCode
? "Country: " + loParser.Country
?

loParser.FullName = "Mrs. Bellenton, Susan Elizabeth"
loParser.Address = "315 SW 3rd Street" + CHR(13) + "Pipestone, MN 56164"
? "Title: " + loParser.Title
? "First Name: " + loParser.FirstName
? "Middle Name: " + loParser.MiddleName
? "Last Name: " + loParser.LastName
? "Suffix Name: " + loParser.Suffix
? "Last Comma First: " + loParser.LastNameAndFirstName
? "Initials: " + loParser.Initials
? "Street: " + loParser.Street
? "City: " + loParser.City
? "State: " + loParser.State
? "PostalCode: " + loParser.PostalCode
? "Country: " + loParser.Country
?

**********************************************
DEFINE CLASS clsOutlookParser as custom
**********************************************

    FullName = ""
    Title = ""
    FirstName = ""
    LastName = ""
    MiddleName = ""
    Suffix = ""
    LastNameAndFirstName = ""
    Initials = ""
    Address = ""
    Street = ""
    PostOfficeBox = ""
    City = ""
    State = ""
    PostalCode = ""
    Country = ""
    OutlookApp = NULL
    ContactItem = NULL
        
    PROCEDURE init
        this.OutlookApp = CreateObject("Outlook.Application")
        this.ContactItem = this.OutlookApp.CreateItem(2) && 2 = Contact Item
    ENDPROC
    
    PROCEDURE FullName_Assign
        LPARAMETERS m.vNewVal
        this.ContactItem.FullName = m.vNewVal
    ENDPROC
    
    PROCEDURE FullName_Access
        RETURN this.ContactItem.FullName
    ENDPROC
    
    PROCEDURE Title_Access
        RETURN this.ContactItem.Title
    ENDPROC
    
    PROCEDURE FirstName_Access
        RETURN this.ContactItem.FirstName
    ENDPROC
    
    PROCEDURE MiddleName_Access
        RETURN this.ContactItem.MiddleName
    ENDPROC
    
    PROCEDURE LastName_Access
        RETURN this.ContactItem.LastName
    ENDPROC
    
    PROCEDURE Suffix_Access
        RETURN this.ContactItem.Suffix
    ENDPROC

    PROCEDURE LastNameAndFirstName_Access
        RETURN this.ContactItem.LastNameAndFirstName
    ENDPROC

    PROCEDURE Initials_Access
        RETURN this.ContactItem.Initials
    ENDPROC

    PROCEDURE Address_Assign
        LPARAMETERS m.vNewVal
        this.ContactItem.OtherAddress = m.vNewVal
    ENDPROC
    
    PROCEDURE Address_Access
        RETURN this.ContactItem.OtherAddress
    ENDPROC

    PROCEDURE Street_Access
        RETURN this.ContactItem.OtherAddressStreet
    ENDPROC

    PROCEDURE City_Access
        RETURN this.ContactItem.OtherAddressCity
    ENDPROC

    PROCEDURE State_Access
        RETURN this.ContactItem.OtherAddressState
    ENDPROC

    PROCEDURE PostalCode_Access
        RETURN this.ContactItem.OtherAddressPostalCode
    ENDPROC

    PROCEDURE Country_Access
        RETURN this.ContactItem.OtherAddressCountry
    ENDPROC
    
    PROCEDURE Destroy
        this.ContactItem.Close(1) && 1 = Discard
        this.OutlookApp.Quit()
        this.ContactItem = NULL
        this.OutlookApp = NULL
    ENDPROC
    
ENDDEFINE && clsOutlookParser

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close