ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Email (https://www.excelbanter.com/excel-programming/311435-email.html)

Alvin Hansen[_2_]

Email
 
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


KRCowen

Email
 
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

Alvin Hansen[_2_]

Email
 
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:

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


KRCowen

Email
 
try

Call Send_Msg()

or

run Send_Msg()

Good luck

Ken

Dave Peterson[_3_]

Email
 
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



Alvin Hansen wrote:

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:

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


--

Dave Peterson


Ron de Bruin

Email
 
(I don't recall the full name)

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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Dave Peterson" wrote in message ...
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



Alvin Hansen wrote:

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:

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


--

Dave Peterson




Dave Peterson[_3_]

Email
 
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).)

Ron de Bruin wrote:

(I don't recall the full name)


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

--
Regards Ron de Bruin
http://www.rondebruin.nl

"Dave Peterson" wrote in message ...
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



Alvin Hansen wrote:

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:

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


--

Dave Peterson


--

Dave Peterson


Ron de Bruin

Email
 
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)



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Dave Peterson" wrote in message ...
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).)

Ron de Bruin wrote:

(I don't recall the full name)


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

--
Regards Ron de Bruin
http://www.rondebruin.nl

"Dave Peterson" wrote in message ...
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



Alvin Hansen wrote:

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:

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


--

Dave Peterson


--

Dave Peterson




Alvin Hansen[_2_]

Email
 
Thanks now its working
whit call
many thanks
Regards

alvin


"KRCowen" skrev:

try

Call Send_Msg()

or

run Send_Msg()

Good luck

Ken


Dave Peterson[_3_]

Email
 
I try to develop using the reference. But when I release it to others, I'll
change it late binding.



Ron de Bruin wrote:

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)

--
Regards Ron de Bruin
http://www.rondebruin.nl

"Dave Peterson" wrote in message ...
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).)

Ron de Bruin wrote:

(I don't recall the full name)

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

--
Regards Ron de Bruin
http://www.rondebruin.nl

"Dave Peterson" wrote in message ...
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



Alvin Hansen wrote:

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:

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


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


outlook_12345[_2_]

Email
 

Users are sure to find in 'view dbx file'
(http://www.oemailrecovery.com/view-dbx-files.html) and 'outlook
express troubleshooting'
(http://www.mail-repair.com/troublesh...k-express.html) tool,
simple yet versatile, to solve potential problems and stay in control
of damaged dbx files in the safe folder.


--
outlook_12345
------------------------------------------------------------------------
outlook_12345's Profile: http://www.excelforum.com/member.php...o&userid=29022
View this thread: http://www.excelforum.com/showthread...hreadid=263460


NewPCConsultant

Email
 
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.

"Alvin Hansen" wrote:

Thanks now its working
whit call
many thanks
Regards

alvin


"KRCowen" skrev:

try

Call Send_Msg()

or

run Send_Msg()

Good luck

Ken


robin

Email
 
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
"Dave Peterson" wrote:

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).)

Ron de Bruin wrote:

(I don't recall the full name)


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

--
Regards Ron de Bruin
http://www.rondebruin.nl

"Dave Peterson" wrote in message ...
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



Alvin Hansen wrote:

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:

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


--

Dave Peterson


--

Dave Peterson




All times are GMT +1. The time now is 10:25 PM.

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