Email Macro

white6174

Board Regular
Joined
May 6, 2002
Messages
137
I need a macro that will automatically email my workbook (From inside the workbook) to a predefined email address.
I would like to send just one of the sheets.


thanks for any help steve w
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
What e-mail client are you using?

A quick board search witht the client name (Outlook, Lotus Notes, etc.,) will yield a ton of results.

Smitty
 
Upvote 0
outlook,
heres what i found


but I get a warning from outlook (about posible virus, need to turn this off)

and I need to add an attachment of the current file

Sub SendingSheet()
Application.DisplayAlerts = False
Dim oMSOutlook As Object
Dim oEmail As Object

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

With oEmail
.To = "white6174@earthlink.net"
'.CC = ActiveSheet.Cells(2, 1)
'.BCC = ActiveSheet.Cells(3, 1)
.Send
End With


Set oMSOutlook = Nothing
Set oEmail = Nothing
Application.DisplayAlerts = True
End Sub
 
Upvote 0
Hi Ivan;

Do you mean that, we can bypass the security patch ? I've searched your site with this subject but the links were not active.
 
Upvote 0
Have a look here for Redemption

http://www.dimastr.com/redemption/
code somthing like;;;

<pre><FONT COLOR="#00007F">Option</FONT> <FONT COLOR="#00007F">Explicit</FONT>


<FONT COLOR="#00007F">Private</FONT> <FONT COLOR="#00007F">Sub</FONT> EMailViaRedemption(strRecipAddr <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">String</FONT>, strFileFullPathName <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">String</FONT>)

<FONT COLOR="#00007F">Dim</FONT> SafeItem <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>
<FONT COLOR="#00007F">Dim</FONT> oItem <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>
<FONT COLOR="#00007F">Dim</FONT> App <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>
<FONT COLOR="#00007F">Dim</FONT> MyAttachments <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>

<FONT COLOR="#00007F">On</FONT> <FONT COLOR="#00007F">Error</FONT> <FONT COLOR="#00007F">GoTo</FONT> EndProperly

<FONT COLOR="#00007F">Set</FONT> App = CreateObject("Outlook.Application")
<FONT COLOR="#007F00">'// Create an instance of Redemption.SafeMailItem</FONT>
<FONT COLOR="#00007F">Set</FONT> SafeItem = CreateObject("Redemption.SafeMailItem")
<FONT COLOR="#007F00">'// Create a new message</FONT>
<FONT COLOR="#00007F">Set</FONT> oItem = App.CreateItem(0)

<FONT COLOR="#007F00">'// Now create the SafeItems</FONT>
<FONT COLOR="#00007F">With</FONT> SafeItem
.Item = oItem
.Recipients.Add strRecipAddr
.Recipients.ResolveAll
<FONT COLOR="#00007F">Set</FONT> MyAttachments = .Attachments
MyAttachments.Add strFileFullPathName
.Subject = "Redemption: " & Format(Date, "mmmm,dd")
.Send
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">With</FONT>

EndProperly:

<FONT COLOR="#00007F">Set</FONT> SafeItem = <FONT COLOR="#00007F">Nothing</FONT>
<FONT COLOR="#00007F">Set</FONT> oItem = <FONT COLOR="#00007F">Nothing</FONT>
<FONT COLOR="#00007F">Set</FONT> App = <FONT COLOR="#00007F">Nothing</FONT>
<FONT COLOR="#00007F">Set</FONT> MyAttachments = <FONT COLOR="#00007F">Nothing</FONT>


<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">Sub</FONT>

</pre>
 
Upvote 0
heres my modified code

problem
no matter what I change the email address to it always sends it to my inbox

thanks steve

Sub EMailViaRedemption()
Dim SafeItem As Object
Dim oItem As Object
Dim App As Object
Dim MyAttachments As Object
Dim strRecipAddr As String
Dim strFileFullPathName As String
ActiveWorkbook.Save
strRecipAddr = "steve@designselect.net"
strFileFullPathName = ActiveWorkbook.FullName
On Error GoTo EndProperly
Set App = CreateObject("Outlook.Application")
'// Create an instance of Redemption.SafeMailItem
Set SafeItem = CreateObject("Redemption.SafeMailItem")
'// Create a new message
Set oItem = App.CreateItem(0)
'// Now create the SafeItems

With SafeItem
.Item = oItem
.Recipients.Add strRecipAddr
.Recipients.ResolveAll
oItem.Attachments.Add ActiveWorkbook.FullName
' MyAttachments.Add 'Set MyAttachments =
.Subject = "Selection Test: -" & Sheet1.Range("C8") & " - " & Format(Date, "mmmm,dd")
.Send
End With
EndProperly:
Set SafeItem = Nothing
Set oItem = Nothing
Set App = Nothing
Set MyAttachments = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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