There's an e-mail example in the VFP samples and also the book on Automation
with VFP by Granor available at Hentzenwerke.com is a nice reference--it
won't tell you everything but gives a good set of examples and getting your
feet wet. While you can't record macros and read the code as in Word and
Excel, the Outlook help does cover VB usage under "Advanced Customization".
You'd need to "FoxPro-ize" the syntax, but the examples are close and the
objects are documented.
I'm far from a master, but the following example opens Outlook, creates the
necessary Outlook objects then spins through a table of e-mails,
manipulating the body of the e-mail, and other components then sends it out.
Hope it helps,
John
#DEFINE oFolderDisplayNormal 0
oOutlook = CreateObject("Outlook.Application")
oNameSpace = oOutlook.GetNameSpace("MAPI")
oExplorer = oOutlook.Explorers.Add( oNameSpace.Folders[1],
oFolderDisplayNormal )
* The NameSpace effectively provides a gateway to Outlook's objects. It's
pretty much required
* and implies that the getnamespace will be needed pretty much any time
we're automating Outlook.
* MyTable ( EMailAddress C (100), MessageText M, Attachment C (100) )
SELECT MyTable
SCAN
oMailItem = oOutlook.CreateItem( 0 ) && The MailItem constant as opposed
to a task, etc.
WITH oMailItem
.Subject = RptQuery
.Body = MyTable.MessageText
.Body = .Body + CHR( 13 ) + "This message was automation-created
with VFP!"
.Recipients.Add( ALLTRIM( MyTable.EMailAddress ) )
LastRecipient = .Recipients.Add( ALLTRIM( "m...@mycompany.com" ) )
LastRecipient.Type = 2 && Carbon Copy
.Attachments.Add( FULLPATH( ALLTRIM( MyTable.Attacment ) ) )
.Send()
ENDWITH
ENDSCAN
oOutlook.Quit()
RELEASE oOutlook
"Jacko" <som...@somewhere.com> wrote in message
news:17c101c14055$ed46c300$a5e62ecf@tkmsftngxa07...
Rick
"Jacko" <som...@somewhere.com> wrote in message
news:17c101c14055$ed46c300$a5e62ecf@tkmsftngxa07...
>.
>