bamaisgreat
Well-known Member
- Joined
- Jan 23, 2012
- Messages
- 831
- Office Version
- 365
- Platform
- Windows
Does anyone know a simple code for emailing the worksheet instead of the entire workbook.
Sub HOLYCRAP()
'
' HOLYCRAP Macro
'
'
ActiveSheet.Unprotect
Range("A4:Q23").Select
Range("Q4").Activate
With Selection.Interior
Selection.Interior.ColorIndex = 35
'.Pattern = xlSolid
'.PatternColorIndex = xlAutomatic
'.ThemeColor = xlThemeColorDark2
'.TintAndShade = -9.99786370433668E-02
'.PatternTintAndShade = 0
End With
ActiveWorkbook.Save
Range("I4").Select
ActiveWindow.SmallScroll Down:=-18
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
ActiveWorkbook.SaveAs Filename:="H:\Burney Table\Operators Form\56 Mach" & _
Format(Now(), "mm-dd-yyyy hh-mm-ss"), FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
Range("A23").Select
Range("H3").Select
'Sub Mail_Workbook_1()
' Works in Excel 2000, Excel 2002, Excel 2003, Excel 2007, Excel 2010, Outlook 2000, Outlook 2002, Outlook 2003, Outlook 2007, Outlook 2010.
' This example sends the last saved version of the Activeworkbook object .
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
' Change the mail address and subject in the macro before you run it.
With OutMail
.To = "dpotter@ggsteel.com"
.CC = ""
.BCC = ""
.Subject = "56 Machine Cutting Form"
.Body = "Only check the form that is green filled!"
.Attachments.Add ActiveWorkbook.FullName
' You can add other files by uncommenting the following line.
'.Attachments.Add ("C:\test.txt")
' In place of the following statement, you can use ".Display" to
' display the mail.
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Application.Quit
'ActiveWorkbook.Close
End Sub
Thanks for all the help..
Sub HOLYCRAP()
'
' HOLYCRAP Macro
'
'
ActiveSheet.Unprotect
Range("A4:Q23").Select
Range("Q4").Activate
With Selection.Interior
Selection.Interior.ColorIndex = 35
'.Pattern = xlSolid
'.PatternColorIndex = xlAutomatic
'.ThemeColor = xlThemeColorDark2
'.TintAndShade = -9.99786370433668E-02
'.PatternTintAndShade = 0
End With
ActiveWorkbook.Save
Range("I4").Select
ActiveWindow.SmallScroll Down:=-18
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
ActiveWorkbook.SaveAs Filename:="H:\Burney Table\Operators Form\56 Mach" & _
Format(Now(), "mm-dd-yyyy hh-mm-ss"), FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
Range("A23").Select
Range("H3").Select
'Sub Mail_Workbook_1()
' Works in Excel 2000, Excel 2002, Excel 2003, Excel 2007, Excel 2010, Outlook 2000, Outlook 2002, Outlook 2003, Outlook 2007, Outlook 2010.
' This example sends the last saved version of the Activeworkbook object .
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
' Change the mail address and subject in the macro before you run it.
With OutMail
.To = "dpotter@ggsteel.com"
.CC = ""
.BCC = ""
.Subject = "56 Machine Cutting Form"
.Body = "Only check the form that is green filled!"
.Attachments.Add ActiveWorkbook.FullName
' You can add other files by uncommenting the following line.
'.Attachments.Add ("C:\test.txt")
' In place of the following statement, you can use ".Display" to
' display the mail.
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Application.Quit
'ActiveWorkbook.Close
End Sub
Thanks for all the help..