Email

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I bave read some off the Questions in this forum about Excel and email
but all off them is about a error and so on.

CAn some one tell be from the start please, iahve a user form with some values
can i ( and how) make a commandbuttom there send this values to outlook and
start outlook, the values are email adress, and some information

Best regards alvin
 
Alvin

The following is code I use to automatically send an outlook message, with
values taken from a spreadsheet. The macro is assigned to a command button on
the worksheet.

Sub Send_Msg()

Dim objOL As New Outlook.Application
Dim objMail As MailItem
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)

msg = "Dianne," & Chr(13) & Chr(13)
msg = msg & "The attached excel file shows a new job that needs to be setup." &
Chr(13)
msg = msg & "Please inform Bruce of the job number." & Chr(13) & Chr(13)
msg = msg & "Thanks. Ken"

addee = range("a1").value
CC = range("b1").value

With objMail
.To = addee
.CC = CC
.Subject = "New job"
.Body = msg
.Display
.Send
End With

Set objMail = Nothing
Set objOL = Nothing

MsgBox "File has been e-mailed to " & addee

End Sub

Like a lot of the stuff I use, this is patterned after something I learned in
this newsgroup.

I hope this helps.

Ken
 
Thank you very much
Its working but i get an error when i will assigned to a command button
i have this
Private Sub CommandButton1_Click()
Send_Msg()
End Sub
HEre i get an error
what do i do wrong
Regards alvin


"KRCowen" skrev:
 
Maybe you need to add a reference to Outlook.

Inside the VBE with your project selected,
tools|references|search for MS Outlook (I don't recall the full name) and select
it.

If you'll share the workbook/macro with others and they run different versions
of Outlook, you may want to remove the reference and use late binding.

Dick Kusleika has a web page at:
http://www.dicks-clicks.com/excel/olBinding.htm
that explains this with Outlook
 
(I don't recall the full name)

1) Go to the VBA editor, Alt -F11
2) Tools>References in the Menu bar
3) Place a Checkmark before Microsoft Outlook ? Object Library
? is the Excel version number
 
Thanks, Ron.

(I bet I could have looked at your site, huh? But I do think that late binding
is safer (and will require fewer updates later).)
 
Hi Dave
(I bet I could have looked at your site, huh? But I do think that late binding
is safer (and will require fewer updates later).)

I agree, but
1) You miss this : Intellisense showing you the properties and methods
2) and Early binding is a bit faster

I have a Late binding example below all my Outlook examples on my site
(and a link to Dick's site)
 
I try to develop using the reference. But when I release it to others, I'll
change it late binding.


Hi Dave
(I bet I could have looked at your site, huh? But I do think that late binding
is safer (and will require fewer updates later).)

I agree, but
1) You miss this : Intellisense showing you the properties and methods
2) and Early binding is a bit faster

I have a Late binding example below all my Outlook examples on my site
(and a link to Dick's site)
 
Hey Guys,
I stumbled onto this issue as well, but I am so new at this that I have no
clue where to insert the email address of the person that I want to send it
to. Any help would be greatly appreciated.
 
I can not send e mail to my instructor at school when I have used microsoft
to write my paper. Can someone help me? This is the message I getA time-out
occurred while communicating with the server. Account: 'HTTP', Server:
'aol.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Error Number: 0x800CCC19
Please help me?
Thanks Robin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top