ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Email From Excel/VBA (https://www.excelbanter.com/excel-programming/365836-email-excel-vba.html)

mtm4300 via OfficeKB.com

Email From Excel/VBA
 
I am trying to give a user the ability to comment via email. They click on my
email address and Outlook will appear with my email address on the "To:" line.
Here is the following code that I am using:

Private Sub Label35_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

ThisWorkbook.FollowHyperlink "mailto:" & Me.Label35.Caption

End Sub

This works when I have Outlook open. However, when Outlook is closed and then
opened and text is entered into the body of the email; I get an error. "A
fatal error has occured in Outlook. The data in your envelope has been lost,
but the document is still available." I do not know how to fix this error.

Also, instead of a Double Click Event, I would like just a Click Event. I
tried changing DblClick to Click, but something is wrong with the declaration.
Any ideas?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200606/1

Norman Jones

Email From Excel/VBA
 
Hi MTM,

Ron de Bruin has an extensive range of sample Outlook code at:

http://www.rondebruin.nl/sendmail.htm

which may provide with ideas for an alternative solution.


---
Regards,
Norman


"mtm4300 via OfficeKB.com" <u18572@uwe wrote in message
news:628181df79c8d@uwe...
I am trying to give a user the ability to comment via email. They click on
my
email address and Outlook will appear with my email address on the "To:"
line.
Here is the following code that I am using:

Private Sub Label35_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

ThisWorkbook.FollowHyperlink "mailto:" & Me.Label35.Caption

End Sub

This works when I have Outlook open. However, when Outlook is closed and
then
opened and text is entered into the body of the email; I get an error. "A
fatal error has occured in Outlook. The data in your envelope has been
lost,
but the document is still available." I do not know how to fix this error.

Also, instead of a Double Click Event, I would like just a Click Event. I
tried changing DblClick to Click, but something is wrong with the
declaration.
Any ideas?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200606/1




mtm4300 via OfficeKB.com

Email From Excel/VBA
 
I have looked at his site. His site talks about how to send data from Excel
to Outlook. I am wanting to just open Outlook and put my name in for the
recipient. The user will then type there message in Outlook. I do not need to
send any sheets, workbooks, cell values, etc. It sounds very simple, but I am
having troubles. It only works when I have Outlook open. If Outlook is closed
and then opened by my macro, the message will not be sent due to an error.
Anyone have a solution?

Norman Jones wrote:
Hi MTM,

Ron de Bruin has an extensive range of sample Outlook code at:

http://www.rondebruin.nl/sendmail.htm

which may provide with ideas for an alternative solution.

---
Regards,
Norman

I am trying to give a user the ability to comment via email. They click on
my

[quoted text clipped - 19 lines]
declaration.
Any ideas?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200606/1

Norman Jones

Email From Excel/VBA
 
Hi M,

As a very minor adaptation of one of Ron's examples, try

'============
Sub Mail_small_Text_Outlook()
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strbody As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
strbody = ""

With OutMail
.To = " '<<=== CHANGE
.CC = ""
.BCC = ""
.Subject = ""
.Body = strbody
.Display
End With

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

'<<============


---
Regards,
Norman



"mtm4300 via OfficeKB.com" <u18572@uwe wrote in message
news:628201d44fdd3@uwe...
I have looked at his site. His site talks about how to send data from Excel
to Outlook. I am wanting to just open Outlook and put my name in for the
recipient. The user will then type there message in Outlook. I do not need
to
send any sheets, workbooks, cell values, etc. It sounds very simple, but I
am
having troubles. It only works when I have Outlook open. If Outlook is
closed
and then opened by my macro, the message will not be sent due to an error.
Anyone have a solution?

Norman Jones wrote:
Hi MTM,

Ron de Bruin has an extensive range of sample Outlook code at:

http://www.rondebruin.nl/sendmail.htm

which may provide with ideas for an alternative solution.

---
Regards,
Norman

I am trying to give a user the ability to comment via email. They click
on
my

[quoted text clipped - 19 lines]
declaration.
Any ideas?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200606/1





All times are GMT +1. The time now is 05:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com