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

Tips -N- Tricks

How can I create a mailing list from the Windows Address Book? by ChrisRChamberlain
Posted: 8 Nov 03 (Edited 8 Nov 03)

The Windows Address Book is common to all versions of Windows and can be used in conjuction with Outlook, Outlook Express and other email clients.

If you want to create a list of contacts and their email addresses for emailing or any other purpose, try the following :-

Make sure the Windows Address Book is available through Outlook, Outlook Express or other email client.

Alternatively, launch wab.exe via ShellExecute(), WSH or the RUN /N command.

In the .OLEDragDrop() event of a control, (.OleDropMode property of the control needs to be 1), of a VFP form, put :-

LOCAL aFiles[1] ,;
    i,;
    lcCont_name,;
    lcEmail_Add,;
    lnRecNo

DO CASE
CASE oDataObject.GETFORMAT(1)
    oDataObject.GETDATA(1,@aFiles)
    IF ALEN(aFiles) > 0
        CREATE CURSOR MAILINGLIST (cont_name C(100), email_add C(254))
        STRTOFILE(oDataObject.GETDATA(1),[C:\Temp\mailinglist.txt])
        CREATE CURSOR EMAILADDRESSES (cline C(254))
        APPEND FROM C:\Temp\mailinglist.txt SDF
        SCAN FOR ALLTRIM(EMAILADDRESSES.cline) = [E-mail Address(es):]
            lnRecNo = RECNO([EMAILADDRESSES])
            GO lnRecNo - 1
            lcCont_Name = ALLTRIM(EMAILADDRESSES.cline)
            GO lnRecNo + 1
            lcEmail_add = ALLTRIM(EMAILADDRESSES.cline)
            INSERT INTO MAILINGLIST (cont_name, email_add) VALUES (lcCont_Name, lcEmail_Add)
        ENDSCAN
        USE IN EMAILADDRESSES
    ENDI        
ENDC

With both your VFP application and the Windows Address Book visible on the screen, all a user has to do it to select entries from the Windows Address Book, using SHIFT+CLICK, CTRL+CLICK or LEFT CLICK, and drag and drop them onto the VFP control.

To view the cursor put :-

SELECT MAILINGLIST    
BROWSE

wherever it suits after the above code block.

There are many more properties available using this technique other than simply the name and email address and include the 'Notes' attached to the contact.

Have fun!

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