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

Pasting into Outlook for Mailing

Status
Not open for further replies.

Headwinds

Programmer
Feb 6, 2001
38
US
I'd like to have FoxPro pop up the Outlook mail reader and display a completed e-mail message that the user can review, edit, send, or abandon. The following code gets me almost there--but the user still has to click Ctrl-V to paste in the message. The insertion point is already positioned correctly.

Code:
m.eaddress = 'myaddress@hotmail.com'
m.mysubject = 'This is my subject.'
_cliptext = 'This is my message, pasted in from the ClipBoard.'
CLEAR DLLS
DECLARE INTEGER ShellExecute IN Shell32 LONG hwnd, STRING lpOperation, STRING lpFile
DECLARE INTEGER GetActiveWindow IN Win32api
WAIT WINDOW "Click Ctrl-V to insert message." NOWAIT
ShellExecute(GetActiveWindow(), 'Open', 'mailto:' + ;
m.eaddress + '?subject=' + m.mysubject)

Execution halts after the ShellExecute() until the user closes the Outlook window, so--even if I could figure out how to use _EdPaste(), it wouldn't do the paste while Outlook is still open.

I have found articles in MSKB on sending e-mail from VFP using active messaging (Q175052), MAPI (Q152772), or OLE messaging (Q146641); but none of these schemes opens the mail reader that the user knows and loves and allows her to inspect and edit the message before it goes out.

Is there any way to do this?
 
Headwinds

I don't have an answer for you, but a question. Why do you clear DLLS. Aren't affraid to clear other DLLS that shouldn't be in the process?
 
Inexperience with the whole business of using DECLARE, etc.
 
HI
o=createobject("outlook.application")
oitem=o.createitem(0)
oitem.subject="Email From VFP6"
oitem.to="ramani_g@yahoo.com"
oitem.body="This mail was sent from vfp using Outlook98"
oItem.Display
** oitem.Attachments.Add("E:\WINNERS\GL\TEST.TXT")
** oitem.send
** o=.null.
Hope this helps you :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Headwinds,

As usual our friend Ramini, I would suggest has your answer. Automation offers more "known" control over outlook than an API call. I would suggest your try his suggestion.
 
Just what I needed! Thank you all.

{Begin Rant}
Automation's "known" methods of control are certainly not known to me. Where can I find a complete, reliable, and specific account of how I can use Automation from VFP to control other software? Whenever I've needed to do this, it has come down to trying to find somebody else who has gone before or enduring a lengthy trial-and-error period (with absolutely no "you're getting close" clues) in which I try to convert fragments of an example that is said to work in VB to something that will work for VFP. Every time I find specific guidance on Automation, it's for VB programmers--and the syntax that works for VB is not what works for VFP. {End Rant}

Anyway, thanks for solving the Outlook automation mystery for me.
 
Headwinds

Oh, come you are a programmer. You should know about trying something and re-booting 20 times a day (Just kidding).
There is a book available at :

Otherwise you are stuck whith partial code that might work for somebody and not for you. Just ask the questions and will see what we come up with.
 
I might add that while you might not care particularly for VB for programming, it's not all that hard to learn enough of it to be able to translate from VB into VFP, with the added advantage that if someone has a VB program which isn't doing working properly, you can offer to change it into a VFP program and gain a reputation as a multitalented dude. Dave Dardinger
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top