ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Select range in macro (https://www.excelbanter.com/excel-discussion-misc-queries/256791-select-range-macro.html)

Chris

Select range in macro
 
Hi all.

I have found a macro that will email the active worksheet. On the worksheet
I have 2 command buttons and some instructions for the operater so they know
where to input info. How can I select a range so that only a specific area
will be sent. Below is the macro and the area I want to send is ("A1:J69").
Your help would be of great help.

Regards
Chris



Public Sub Email_Midnight_Report()
Dim wb As Workbook

Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Email_ " & ThisWorkbook.Name _
& ".xls" 'create a temporary workbook to email
.SendMail ", _
"Midnight Report"
.ChangeFileAccess xlReadOnly
Kill .FullName 'delete temporary file
.Close False
End With
Application.ScreenUpdating = True
End Sub


Jacob Skaria

Select range in macro
 
Chris

Check out the below by Ron de Bruin..

http://www.rondebruin.nl/mail/folder1/mail4.htm

--
Jacob


"Chris" wrote:

Hi all.

I have found a macro that will email the active worksheet. On the worksheet
I have 2 command buttons and some instructions for the operater so they know
where to input info. How can I select a range so that only a specific area
will be sent. Below is the macro and the area I want to send is ("A1:J69").
Your help would be of great help.

Regards
Chris



Public Sub Email_Midnight_Report()
Dim wb As Workbook

Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Email_ " & ThisWorkbook.Name _
& ".xls" 'create a temporary workbook to email
.SendMail ", _
"Midnight Report"
.ChangeFileAccess xlReadOnly
Kill .FullName 'delete temporary file
.Close False
End With
Application.ScreenUpdating = True
End Sub



All times are GMT +1. The time now is 08:23 AM.

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