View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default How to save a worksheet seperately in addition to part of wrkb

Hi Rocketta

Thanks for the response but I'm not sure where I add/run this code?


Alt -F11
InsertModule from the menu bar
Paste the sub
Change the sheet names and e-mail addresses in the macro
Alt-Q to go back to Excel

If you use Alt-F8 you get a list of your macro's
Select "Mail_test" and press Run


Maybe a other example is better on my site but start with this one
Change the sheet names and e-mail addresses in this two lines

Shname = Array("Sheet1", "Sheet2", "Sheet3", "Sheet4")
Addr = ", ", ", ")


The example below will send each sheet in the Shname Array
to a person In the Addr Array.
In this example four separate mails will be send with one sheet.

Sheet1 to
Sheet2 to

Sheet3 to

Sheet4 to



Sub Mail_test()
Dim wb As Workbook
Dim strdate As String
Dim Shname As Variant
Dim Addr As Variant
Dim N As Integer

strdate = Format(Now, "dd-mm-yy h-mm-ss")
Shname = Array("Sheet1", "Sheet2", "Sheet3", "Sheet4")
Addr = ", ", ", ")

Application.ScreenUpdating = False

For N = LBound(Shname) To UBound(Shname)
Sheets(Shname(N)).Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & Shname(N) _
& " " & strdate & ".xls"
.SendMail Addr(N), _
"This is the Subject line"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Next N
Application.ScreenUpdating = True
End Sub



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



"Rocketta" wrote in message ...
Thanks for the response but I'm not sure where I add/run this code?

"Ron de Bruin" wrote:

Hi Rocketta

You can try this with code
http://www.rondebruin.nl/sendmail.htm

Maybe
http://www.rondebruin.nl/mail/folder1/mail5.htm
Or only for Outlook
http://www.rondebruin.nl/mail/folder2/mail5.htm

See also the templates on my site


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



"Rocketta" wrote in message ...
Hi,

I want to have a workbook that contains several sheets of information but
I need to send the sheets out individually as well. So I was wondering is
there anyway to save an individual sheet seperately or email an individual
sheet?