View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Sending files by e-mail

Try this

Sub Mail_ActiveSheet()
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs Filename:="Part of " & ThisWorkbook.Name _
& " " & strdate, FileFormat:=xlCSV

.SendMail ", _
"This is the Subject line"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub

You can use this also Sheets("Sheet5").Copy

See the example for send ing a sheets array on my site also



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Gareth" wrote in message ...
I have an application, which when the user has finished with it, 3 files
have to be created and sent to other departments.

Previously the process of creating the files (extracting certain data from
the file) was done by macro and the new file was then sent manually.

I believe there is a way to automatically send these files. One of the
files is just one sheet and MUST be saved in.csv format, I have tried to do
this with code from ron de bruin's site but with no luck. This sheet is not
copied, it is a new sheet which data is copied to - it is then moved to a
new file.

The other two files have 2 and 5 sheets to be copied form the original file,
both saved as .xls

Any help gratefully received.

Gareth (confused)