Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 To: Alfred Roost
  Where is Alfred Roost?
 Schaffhausen
 Switzerland
 Alfred Roost
 Tags
Subject: RE: VFP Outlook
Thread ID: 228527 Message ID: 228534 # Views: 2 # Ratings: 0
Version: Visual FoxPro 8 Category: Microsoft Office Automation
Date: Tuesday, May 19, 2009 5:31:06 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 CR CHR(13)
> #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)
> ldstart=lv_kunden_logbuch.pdatum
> lcmedium=ALLTRIM(THIS.PARENT.noTIZ.value)
>
> IF VARTYPE(oOutlook) <> "O"
> * Start or connect to Outlook
> RELEASE oOutlook
> LOCAL oOutlook
> oOutlook = CREATEOBJECT("Outlook.Application")
> ENDIF
>
> 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
> .SAVE()
> ENDWITH
>
> * 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
> .SAVE()
> ENDWITH
>
> RELEASE Outlook
> RETURN

> 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?

PMFJI but AFAIK Della doesn't visit this forum and it is unlikely Tamar would see this in a short time. Try adding .Display() after .Save()

Cetin Basoz

.Net has got better.Think about moving - check my blog:
Blog (main)
Blog (mirror)

ENTIRE THREAD

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