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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Outlook as an object

Status
Not open for further replies.

Johnweida

MIS
Apr 29, 2003
91
CN
experts,

I can open outlook as an object with "createobject('Outlook.application')" under Office XP and heigher version but failed under Office 2000 environment. Does Office 2000 cannot be opened with an object in VFP ?
Thanks for your answers.

John Satellite
 
Johnweida

If that is the case, then I would suggest that if you create an instance of Outlook and direct Outlook to the task directory, without creating any items at that point, that may be enough to allow the reminder alarms to go off.
Code:
#DEFINE olFolderTasks 13
Public oOutLookObject
oOutLookObject = CreateObject("Outlook.Application")
oNameSpace=oOutlookObject.GetNameSpace("MAPI")
oTaskFolder=oNameSpace.GetDefaultFolder(olFolderTasks)


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Try declaring oObject as public. It is presently a local variable that gets thrown away when your menu program terminates.

Code:
*** form's Init
PUBLIC oObject
LOCAL loOutlook
loOutlook = CREATEOBJECT("Outlook.Application")
this.olecontrol1.addImageItem(1,'Appointment',1)
this.olecontrol1.addImageItem(1,'Task',2)
*** etc. ***

*** ActiveX Control Event ***
LPARAMETERS nlist, nitem
#DEFINE olMailItem     0     
#DEFINE olAppointmentItem     1     
#DEFINE olContactItem     2     
#DEFINE olTaskItem     3     
#DEFINE olJournalItem     4     
#DEFINE olNoteItem     5     
#DEFINE olPostItem     6     
#DEFINE olDistributionListItem     7     
DO CASE
   CASE nList = 1 AND nitem = 1
      oObject = loOutlook.CreateItem(olAppointmentItem)
   CASE nList = 1 AND nitem = 2
      oObject = loOutlook.CreateItem(olTaskItem)
   CASE nList = 1 AND nitem = 3
      oObject = loOutlook.CreateItem(olContactItem)
   CASE nList = 1 AND nitem = 4
      oObject = loOutlook.CreateItem(olNoteItem)
   CASE nList = 1 AND nitem = 5
      oObject = loOutlook.CreateItem(olJournalItem)
   CASE nList = 1 AND nitem = 6
      oObject = loOutlook.CreateItem(olDistributionListItem)
   CASE nList = 1 AND nitem = 7
      oObject = loOutlook.CreateItem(olCalendarItem)
ENDCASE      
oObject.Display()




Jean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top