Opening Email With TO: Address and Subject Line

notoca

New Member
Joined
Sep 8, 2003
Messages
37
Hi

On My Menu I want to have a a feedback section. Users can feedback 1) any bugs or problems that occur with the system and 2) Suggestions or changes to the data in some of the tables.

What I'd like is to do is set up two menu options (as mentioned above) where the user clicks on the menu button and it opens up the email program (Outlook Express), simple enough, however, I would like to populate the email with the To: address and the Subject Line data automatically.

Any ideas??

Thanks
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try this code, it opens MS Outlook after cmdSentEmailToTutor button is hit:

Private Sub cmdSentEmailToTutor_Click()

Dim oMSOutlook As Object
Dim oEmail As Object
Dim EmailAddress As String
Dim EmailSubject As String

Set oMSOutlook = CreateObject("Outlook.Application")
Set oEmail = oMSOutlook.CreateItem(olMailItem)

EmailAddress = Trim(txtTutorID.Value) ' Here input control with address
EmailSubject = Trim(txtStudentFirstname.Value & " " & txtStudentSurname.Value) ' here input control with subject


With oEmail
.Subject = EmailSubject
.Body = "Text in the email - may be taken from form as well...."
.To = EmailAddress
.Display
End With


Set oMSOutlook = Nothing
Set oEmail = Nothing

End Sub

aaa....I would forgot - you have to (in VBA view):
Tools/References/Microsoft Outlook XX Object Library (tick)


HTH
 
Upvote 0
Hi

Thanks. That was good. Just one further question. Is it possible to put a carriage return and move to the next line. At the moment the cursor is sitting at the beginning of the text as specified in the .body statement.

The users would probably appreciate having the cursor on the next line which is blank where they can type in any info they desire.

Thanks
 
Upvote 0
To use the regular body, use syntax like:

.Body="test" & vbcrlf & "more Text"

You can use vbcrlf or the Chr() function.

Your email will look like:

test
more Text

HTH,
CT
 
Upvote 0
CT Witter: You are absolutely right!

I wanted to show to much (formating message etc.) I dont even know why. It is not Monday or Friday today :)

THX
 
Upvote 0
Hi

The inserting of lines works, however, that pesky cursor still remains in the same position ie in the first space of the first line. I can't bring the cursor down to the next blank line.

If the users start typing they will be typing before the already existing text automatically inserted using the .ody statement. Is there a way to get the cursor onto the next blank line?

Thanks
 
Upvote 0

Forum statistics

Threads
1,221,614
Messages
6,160,839
Members
451,673
Latest member
wella86

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top