Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detect user cancels email send
Message
 
À
28/09/2011 17:07:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01525141
Message ID:
01525263
Vues:
84
This message has been marked as the solution to the initial question of the thread.
>I'm pretty sure I've seen the solution to this on UT, but can not track it down.
>When automating the sending of email via Outlook, how do I detect if the user has closed the email without sending the email?
>i.e. how do I get a return value from the display() method in the following code, and what would it be in the case of the user aborting the send ?
>
>
>
>loApplication=CREATEOBJECT("Outlook.Application")
>loNameSpace=loApplication.GetNameSpace("MAPI")
>loOutBox=loNameSpace.GetDefaultFolder(4)
>
>* Create message object
>THIS.oMessage=loOutBox.Items.Add
>WITH THIS.oMessage
>  .Body=THIS.cBodyText
>  .Subject=THIS.cSubject
>  IF llShowOutlook
>      .display()
>  ELSE
>    .Send()
>  ENDIF
>ENDWITH
>
>
>Thanks
>Barry Sutton

See if it helps:
loApplication=GetOBJECT(,"Outlook.Application")
lo=loApplication.GetNameSpace("MAPI").GetDefaultFolder(4).Items.Add
WITH lo
	.Body="It is a test. Please, ignore"
	.Subject="Test"
	lctitle=loApplication.ActiveWindow.caption
	.display()
	DO WHILE loApplication.ActiveWindow.caption==lctitle
		WAIT WINDOW TIMEOUT 1.0 "Waiting for message to appear in Outlook ..."
	ENDDO
	lctitle=loApplication.ActiveWindow.caption
	DO WHILE loApplication.ActiveWindow.caption=lctitle
		WAIT WINDOW TIMEOUT 1.0 "Waiting for user action..."
		WAIT WINDOW TIMEOUT 0.3 ""
	ENDDO
ENDWITH
* 
=MESSAGEBOX(IIF(TYPE("lo.sent")="L" and not lo.sent,"NOT ","")+"Sent")

lo=null
Good Luck
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform