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 John Tel 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
 
John

I guess this is a different question then your other thread on the subject.
Creating an instance of Outlook in VFP worked for me in many combinations of versions of FoxPro and Outlook. Currently I'm using VFP8.0 and Outlook 2002 (XP) and it works, but I have used VFP7.0 and Outlook 2009 in the past with no problems. Does Outlook run properly on its own ?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 


Sorry, this should read " but I have used VFP7.0 and Outlook 2000 in the past with no problems."

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
experts,

I put the code below in my form.
**********************
oOutlook = CREATEOBJECT("Outlook.Application")
#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 nItem = 1
oObject = oOutlook.CreateItem(olMailItem)
case nItem = 2
oObject = oOutlook.CreateItem(olTaskItem)
*** etc ***
endcase
oObject.Display

**********************

But I don't know how to activate Outlook(invisible) when my form is opened.Then the reminder will work until user close the form.
Waiting for your help. Thanks.

John Satellite

 
John

But I don't know how to activate Outlook(invisible) when my form is opened.

What do mean "activate"? Once you instanciate Outlook with "oOutlook = CREATEOBJECT("Outlook.Application")", Outlook can be manipulate using the methods and properties of oOutlook. If you mean make it visible you could display the created item by using:
oObject.Display()


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Dear Mike,

The above code is put in my menu. The Outlook reminder does not work if the menu isn't selected. My meaning is the Outlook reminder works immediately when my form is opened. Then users can get reminders from Outlook and choose their items in my menu. I am so sorry for my poor English. Hope you can catch my meaning. Thank you.

John Satellite
 
Dear Mike,

Is there any way to open Outlook in minimum style ?
Thanks.

John Satellite
 
John

The above code is put in my menu. The Outlook reminder does not work if the menu isn't selected. My meaning is the Outlook reminder works immediately when my form is opened. Then users can get reminders from Outlook and choose their items in my menu. I am so sorry for my poor English. Hope you can catch my meaning. Thank you.

So, If I understand correctly, you want to add entries in the Outlook calendar and have the reminder pop-up during a VFP session? I order to have the reminders pop-up all you need to do is instanciate Outlook, but it would have to be instanciated in you main program rather than as a menu selection.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
John

You may also consider looking at faq184-1771, "How to create a task in Outlook".


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Dear Mike,

The code below can call Outlook's functions well.
**********
oOutlook = CREATEOBJECT("Outlook.Application")
#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 nItem = 1
oObject = oOutlook.CreateItem(olMailItem)
case nItem = 2
oObject = oOutlook.CreateItem(olTaskItem)
*** etc ***
endcase
oObject.Display
**********
But the Outlook's reminder pop-up does not work before the menu item is selected.
Is there a way to wake up the Outlook's reminder when my form is opened? In other word, to make Outlook's reminder start working before users selecting menu items.
Thanks.

John Satellite
 
John

But the Outlook's reminder pop-up does not work before the menu item is selected.

When you start your application, is the Outlook object instanciated or is it only started when you make a menu selection.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Dear Mike,

I just want Outlook reminder to start working when I start my application. Now Outlook reminder start working after the menu selection. In other word, it does not work if the menu is not selected. Waiting for your help. Thanks.

John Satellite
 
John

Where did you place the code to instanciate Outlook?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike

The code "oOutlook = CreateObject('Outlook,application')" is put in the menu. I tried to put this code at the form's INIT, but Outlook's reminder does not start working.

John Satellite
 
John

Create a public instance of Outlook and try to put the code to instanciate it in your main program.

Public oOutlook
oOutlook = CreateObject('Outlook,application')

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Dear Mike

Outlook reminder still does not start working. Here is the code :

*** form's Init
PUBLIC oOutlook
oOutlook = 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 = oOutlook.CreateItem(olAppointmentItem)
CASE nList = 1 AND nitem = 2
oObject = oOutlook.CreateItem(olTaskItem)
CASE nList = 1 AND nitem = 3
oObject = oOutlook.CreateItem(olContactItem)
CASE nList = 1 AND nitem = 4
oObject = oOutlook.CreateItem(olNoteItem)
CASE nList = 1 AND nitem = 5
oObject = oOutlook.CreateItem(olJournalItem)
CASE nList = 1 AND nitem = 6
oObject = oOutlook.CreateItem(olDistributionListItem)
CASE nList = 1 AND nitem = 7
oObject = oOutlook.CreateItem(olCalendarItem)
ENDCASE
oObject.Display

John Satellite
 

I'm not sure where the problem lies here. He seem to want to use the Reminder in the Outlook, but your code seems to suggest you want to create items (either new mail, new calendar items etc...)
1. Is there an actual task or scheduled event that exist, so the reminder can detect it?
2. What is the frequency of the reminder set at?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Dear Mike,

Maybe it is a little difficult for you to catch my meaning due to my poor English.
Now I put oOutlook = CreateObject("Outlook.application") into form's Init. Then the form opens. Users can build their new appointment and new task etc. by clicking menu items. But the tasks built before and need to be reminded cannot got Outlook's reminder alarm if users do not select any item from menu. That is my meaning.
Thanks.

John Satellite
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top