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 Apr 16th, 2002, 07:10 AM   #1
Bukol
Board Regular
 
Join Date: Mar 2002
Location: Philippines
Posts: 55
Default

Here is a good one:
I have a list of e-mail addresses in one column.
Question one: how do I convert them (it's text) into a hyperlink without having to type every address by hand?
Or question two: How can I automate to send a separate e-mail message to everyone on that list using some text stored in another sheet of that workbook. I dont want to create a group of recipients, but send single messages.
Hans
Bukol is offline   Reply With Quote
Old Apr 16th, 2002, 07:54 AM   #2
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

Question 1: Try the following code:
Code:
Set rng = Range(Range("A1"), Range("a1").End(xlDown))
For Each cell In rng
ActiveSheet.Hyperlinks.Add Anchor:=cell, Address:="mailto:" & cell.Value
Next
Your email addresses should be in column A, or edit as needed.
__________________
Kind regards,

Al Chara
Al Chara is offline   Reply With Quote
Old Apr 16th, 2002, 08:08 AM   #3
Bukol
Board Regular
 
Join Date: Mar 2002
Location: Philippines
Posts: 55
Default

Al,
thanks, works fine.
What about part two of my question, because even with the list of e-mail - hyperlinks now I was hoping to record a macro to send one e-mail at a time - same subject, same text - to every recipient on that list. But the code doesn't record copy and paste done inside the mailer box. (Outlook Express)
Hans
Bukol is offline   Reply With Quote
Old Apr 16th, 2002, 08:51 AM   #4
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

Do you want to email the workbook as an attachment?
Al Chara is offline   Reply With Quote
Old Apr 16th, 2002, 08:56 AM   #5
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Hi Bukol
This is some code I sent to someone else.
It works on my machine, but he never replied to tell me if it worked for him.

Sub SendMsg()
On Error Resume Next
ThisWorkbook.VBProject.References.AddFromGuid _
"{00062FFF-0000-0000-C000-000000000046}", 9, 0

Dim objOL As New Outlook.Application
Dim objMail As MailItem
Dim SheetName As String
Dim ListColumn As String
Dim FirstRow As Long
Dim Cntr As Long
Dim LastRow As Long

'assumes that all data in this column are valid E-mail addresses
'specify range (Edit the next four assignments to suit)
SheetName = "Sheet1"
ListColumn = 1 'where column A=1,B=2,C=3,ect...
FirstRow = 5
LastRow = 1000 'can be much larger than your actual list

Set objOL = New Outlook.Application

For Cntr = FirstRow To LastRow
If Sheets(SheetName).Cells(Cntr, ListColumn).Value <> "" Then
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = Sheets(SheetName).Cells(Cntr, ListColumn).Value
.Subject = "PSRT"
.Body = "This is a page for PSRT. Please call 627-48??"
.Send
End With
Set objMail = Nothing
End If
Next

Set objOL = Nothing
End Sub

Tom

Oops!
Outlook Express!
Don't think this will help you then...
Will leave it anyway...


[ This Message was edited by: TsTom on 2002-04-16 07:59 ]
Tom Schreiner is offline   Reply With Quote
Old Apr 16th, 2002, 09:06 AM   #6
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

Bukol,

You could also use this, but like Tom said, I don't know if it will work with outlook express:
Code:
Sub EmailList()
Dim olApp As Outlook.Application, olMail As Outlook.MailItem
Dim Rng As Range, Cell As Range

Set olApp = New Outlook.Application

Set Rng = Range(Range("A1"), Range("a1").End(xlDown))

For Each Cell In Rng
    Set olMail = olApp.CreateItem(olMailItem)
    olMail.To = Cell.Value
    olMail.Subject = "Insert Subject"
    olMail.Body = "Insert Body"
    olMail.Send
Next

End Sub
The code was adapted from one that was on this board (I think from dk).
__________________
Kind regards,

Al Chara
Al Chara is offline   Reply With Quote
Old Apr 16th, 2002, 09:15 AM   #7
Bukol
Board Regular
 
Join Date: Mar 2002
Location: Philippines
Posts: 55
Default

Tom,
on line: "Dim objol As New Outlook.Application "
I get Comiple Error Message: user defined type not defined
Do I have to specify OutlookExpress?
Hans
Bukol is offline   Reply With Quote
Old Apr 16th, 2002, 09:18 AM   #8
Bukol
Board Regular
 
Join Date: Mar 2002
Location: Philippines
Posts: 55
Default

Al,
no just some text which is stored on another sheet, so I tried to send the worksheet only, which works fine if I do it manually.
Hans
Bukol is offline   Reply With Quote
Old Apr 16th, 2002, 09:19 AM   #9
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

Hans,

I don't think Tom or my code will work with Outlook express. Try the following code, it should work with all email programs:
Code:
Private 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
Sub SendMail()
Dim Rng As Range, Cell As Range
Dim URL As String, Email As String

Set Rng = Range(Range("A1"), Range("a1").End(xlDown))

For Each Cell In Rng
Email = Cell.Value
URL = "mailto:" & Email & "?subject=" & "Insert Subject" & "&body=" & "Insert Body"
ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%s"
MsgBox "Email Sent"
Next
End Sub
__________________
Kind regards,

Al Chara
Al Chara is offline   Reply With Quote
Old Apr 16th, 2002, 09:22 AM   #10
Bukol
Board Regular
 
Join Date: Mar 2002
Location: Philippines
Posts: 55
Default

Al,
on line one of your code I get the same error as I get in Tom's code.
Hans
Bukol 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 06:06 AM.


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