Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Alfred Roost
  Where is Alfred Roost?
 Alfred Roost
Subject: VFP Outlook
Thread ID: 228527 Message ID: 228527 # Views: 3 # Ratings: 0
Version: Visual FoxPro 8 Category: Microsoft Office Automation
Date: Tuesday, May 19, 2009 4:10:41 PM         

I programmed the building of an appointment and a task with the code of your book „MS Office Automation with Visual FoxPro“ as follows:

* OutlookSample.PRG
* © 2000, Tamar E. Granor and Della Martin
* From: Microsoft Office Automation with Visual FoxPro
* Hentzenwerke Publishing. www.hentzenwerke.com

* Add an appointment, several tasks, and send a related e-mail
* to all TasTrade employees.
#DEFINE olMailItem 0
#DEFINE olAppointmentItem 1
#DEFINE olTaskItem 3
#DEFINE olImportanceHigh 2
#DEFINE MB_ICONINFORMATION 64 && Information message
#DEFINE MB_OK 0 && OK button only
#DEFINE OneDayInSeconds 86400

LOCAL oNameSpace, oMessage, oAppt, oTask, lcsubject, ldstart, lcmedium
lcsubject=ALLTRIM(THIS.PARENT.pAktion.DISPLAYVALUE)+": Kunde "+;
ALLTRIM(STR(lv_kunden_logbuch.kunden_nr))+" "+alltrim(lv_kunden_logbuch.firmaname)+;
'/Kontaktperson: '+alltrim(lv_kunden_logbuch.name)+" "+ALLTRIM (lv_kunden_logbuch.vorname)

IF VARTYPE(oOutlook) <> "O"
* Start or connect to Outlook
RELEASE oOutlook
LOCAL oOutlook
oOutlook = CREATEOBJECT("Outlook.Application")

oNameSpace = oOutlook.GetNameSpace("MAPI")

* First, set up the appointment
oAppt = oOutlook.CreateItem( olAppointmentItem )
WITH oAppt
.Subject = lcsubject
.Location = ""
.START = ldstart
.Duration = 90
.ReminderSet = .T.
.ReminderMinutesBeforeStart = 15
.Body = lcmedium

* Next, the snacks
oTask = oOutlook.CreateItem( olTaskItem )
WITH oTask
.Subject = lcsubject
.DueDate = ldstart
.Categories = lcsubject
* get a reminder a quarter an hour ahead
.ReminderSet = .T.
.ReminderTime = ldstart - 15*60
* Put the information about what and where to order in the task
.Body = lcmedium


This works fine, but my client wishes to immediately open the related appointment or task in Outlook from the program. I couldn’t find some code in the book. How can I do this programmatically (probably with „Shellexecute“)? I’m not able to program with VB. Can you mail me some code to bring this to work?


VFP Outlook Posted by Alfred Roost @ 5/19/2009 4:10:41 PM
RE: VFP Outlook Posted by Cetin Basoz @ 5/19/2009 5:31:06 PM