Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I create a mailing list from the Windows Address Book?

Tips -N- Tricks

How can I create a mailing list from the Windows Address Book?

by  ChrisRChamberlain  Posted    (Edited  )
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 [color blue]wab.exe[/color] via [color blue]ShellExecute()[/color], [color blue]WSH[/color] or the [color blue]RUN /N[/color] command.

In the [color blue].OLEDragDrop()[/color] event of a control, ([color blue].OleDropMode[/color] property of the control needs to be [color blue]1[/color]), of a VFP form, put :-
[color blue]
LOCAL aFiles[1] ,;
[tab]i,;
[tab]lcCont_name,;
[tab]lcEmail_Add,;
[tab]lnRecNo

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

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!
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top