AbuMariam
asked on
I need to open new Outlook Express email from my VB app.
Hi,
I need the code I can use to click on a button to run a new email using Outlook Express with To: supplied by me, just like pressing <a>href="mailto:......</a> in html pages.
Thanks
I need the code I can use to click on a button to run a new email using Outlook Express with To: supplied by me, just like pressing <a>href="mailto:......</a>
Thanks
If you are positive that the user will be using Outlook Express, using this as your button handler would work too...
'------------------------- ---------- ---------- ---------- ---------- -----
Dim obj, msg
Set obj = CreateObject("OutlookExpre ss.Applica tion")
Set msg = obj.CreateItem(0)
msg.To = "no_reply@fakeaddress.com"
msg.Display
'------------------------- ---------- ---------- ---------- ---------- -----
Chris has the better solution if you can't be positive, or if it is likely to ever change.
'-------------------------
Dim obj, msg
Set obj = CreateObject("OutlookExpre
Set msg = obj.CreateItem(0)
msg.To = "no_reply@fakeaddress.com"
msg.Display
'-------------------------
Chris has the better solution if you can't be positive, or if it is likely to ever change.
ASKER
Thanks guys, Chris code is working very well, for your code fishage, the problem is I cannot get the reference for OutlookExpress, I have only a reference for MicroSoftOutlook.
I need to put some details from the calling form in the body of the Mail, can it be done, I think the code of fishage will solve it if I had the reference to OutlookExpress
Thanks guys, I do not know to whom should I give the points, please advice, I think chris was earlier, right?
AbuMariam
I need to put some details from the calling form in the body of the Mail, can it be done, I think the code of fishage will solve it if I had the reference to OutlookExpress
Thanks guys, I do not know to whom should I give the points, please advice, I think chris was earlier, right?
AbuMariam
ASKER
Thanks guys, Chris code is working very well, for your code fishage, the problem is I cannot get the Project ---> References for OutlookExpress, I have only a reference for MicrosoftOutlook.
I need to put some details from the calling form in the body of the Mail, can it be done, I think the code of fishage will solve it if I had the reference to OutlookExpress
Thanks guys, I do not know to whom should I give the points, please advice, I think chris was earlier?
AbuMariam
I need to put some details from the calling form in the body of the Mail, can it be done, I think the code of fishage will solve it if I had the reference to OutlookExpress
Thanks guys, I do not know to whom should I give the points, please advice, I think chris was earlier?
AbuMariam
You can do:
mailto:email@domain&subjec t=my subject&body=body text
Regards, Chris
mailto:email@domain&subjec
Regards, Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Chris,
But it is coming all in the (To:) field of the new mail, like this:
To: emailaddress@domain.com&su bject=This is a test&body=Just a little test to see what we can do
But it is coming all in the (To:) field of the new mail, like this:
To: emailaddress@domain.com&su
"Thanks guys, I do not know to whom should I give the points, please advice, I think chris was earlier, right?"
Give the points to Chris. I felt his answer was correct before I added my comment, i was just adding another way to do it... and it looks like I was wrong. It appears that OutlookExpress can't be scripted the same way Outlook can.
Good luck with your application, it looks like you guys have it just about solved now.
Give the points to Chris. I felt his answer was correct before I added my comment, i was just adding another way to do it... and it looks like I was wrong. It appears that OutlookExpress can't be scripted the same way Outlook can.
Good luck with your application, it looks like you guys have it just about solved now.
Public Declare Function ShellExecute Lib _
"shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Public Const SW_SHOW = 1
and then on the button_click code:
ShellExecute hwnd, "open", "mailto:emailaddress@domai
HTH, Chris