MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 1st, 2002, 07:24 AM   #1
Tina
New Member
 
Join Date: Apr 2002
Posts: 1
Default

I have a custom form created in Excel, the form contains a number of fields for a user to input data. I need a button on the form that fires up Outlook and puts the values of these fields into the message area of a new email, the user would then need to be able to modify the email. Everything I have tried so far simply attaches the workbook as an attachment in an email - which I don't want, the data needs to be in the body of the email.
I then need a second button on the form that writes the data into a database.
Can you help?????
Tina is offline   Reply With Quote
Old May 1st, 2002, 07:43 AM   #2
Mark O'Brien
MrExcel MVP
 
Mark O'Brien's Avatar
 
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
Default

Tina, quick answer to your question:

I believe that there is a way to make a worksheet the body of an email, however, I have yet to crack that one myself. You would need to have an understanding of CDO for this one.

Since I haven't been able to do this myself yet, I'd say that, right now, it can't be done.

I just don't want you banging you head against a wall on this one. I've spent a couple of days recently trying to crack this problem and it's a pain.

If you do get a solution, I'd be very interested to see it as well.

EDIT:: Oops, didn't read the second question, I got too excited. I can't really help you on the DB aspect but what kind of DB is it? Access, Oracle or simply an Excel spreadsheet? (someone will no doubt ask this)
_________________
[b] Mark O'Brien

[ This Message was edited by: Mark O'Brien on 2002-05-01 06:44 ]
Mark O'Brien is offline   Reply With Quote
Old May 1st, 2002, 08:15 AM   #3
dk
MrExcel MVP
 
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
Default

Hi Tina,

Do you want the values from the textboxes in your email, or the worksheet? Your first problem can be solved by using something like this. You'll need to be a bit more specific if you can't get this to work. It assumes you have two textboxes called txtField1 and txtField2 and a command button called cmdOK. In the cmdOK click event use this:- YOU MUST SET A REFERENCE TO THE MICROSOFT OUTLOOK OBJECT LIBRARY IN TOOLS, REFERENCES!

Code:
Private Sub cmdOK_Click()
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem

Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)

olMail.To = "anyone@anywhere.com"
olMail.Subject = "Excel sent this!"
olMail.Body = Me.txtField1.Text
olMail.Body = olMail.Body & Chr(9) & Me.txtField2.Text

olMail.GetInspector.Activate

End Sub
Of course this is a very simple example but it should give you an idea. It simply adds txtField1's value, then a tab character and then txtField2's value.

If you need any further help or I've missed the point then please repost.

Regards,
Dan


Quote:
Mark O'Brien

Since I haven't been able to do this myself yet, I'd say that, right now, it can't be done.
Is that a joke Mark?
dk is offline   Reply With Quote
Old May 1st, 2002, 09:53 PM   #4
Mark O'Brien
MrExcel MVP
 
Mark O'Brien's Avatar
 
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
Default

Quote:
Is that a joke Mark?
Erm, yeah, OK.

No actually, I was reading the post slightly different from you. I was reading "send the worksheet" as the body of the email. When, in fact, more correctly, it was just the data that needed to sent as the body of the mail. (which is entirely possible)
__________________
Mark O'Brien

Columbus Ohio Celtic Supporters Club
Mark O'Brien is offline   Reply With Quote
Old May 1st, 2002, 11:33 PM   #5
Qroozn
Board Regular
 
Join Date: Mar 2002
Location: Sydney/Brisbane , Australia
Posts: 539
Default

Please use the attached macro and custom it to your needs. it send a message(not an attachment)


BoxTitle = ("EXCEL CONTENTS")
Message = "here is the excel info"

'Dimension variables.
Dim OL As Object, MailSendItem As Object

Set OL = CreateObject("Outlook.Application")
Set MailSendItem = OL.CreateItem(olMailItem)

'Creates message
With MailSendItem
.Subject = "LEAD FEED BACK"
.Body = Message
.To = "test@test.com"
.Send
End With

'Ends Outlook session
Set OL = Nothing
MsgBox "Your correspondence has been posted", , "FEEDBACK STATUS"

End Sub
Qroozn is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 07:35 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes