Hi ,
I would like to mail a worksheet ,but for security reasons I would like to convert the worksheet to pdf and send another pdf file at the same time .The second pdf –file is stored always in the same folder ( example : c:\folder\second.pdf) Those two pdf-files should be send .
I hope someone can help me with this
code for sending a worksheet :
Dim strDate As String
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "*@*" Then
sh.Copy
strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss")
ActiveWorkbook.SaveAs "Part of " & ThisWorkbook.Name _
& " " & strDate & ".xls"
ActiveWorkbook.SendMail ActiveSheet.Range("a1").Value, _
"test"
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
ActiveWorkbook.Close False
End If
Next sh
Application.ScreenUpdating = True
Thx
Ed
I would like to mail a worksheet ,but for security reasons I would like to convert the worksheet to pdf and send another pdf file at the same time .The second pdf –file is stored always in the same folder ( example : c:\folder\second.pdf) Those two pdf-files should be send .
I hope someone can help me with this
code for sending a worksheet :
Dim strDate As String
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "*@*" Then
sh.Copy
strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss")
ActiveWorkbook.SaveAs "Part of " & ThisWorkbook.Name _
& " " & strDate & ".xls"
ActiveWorkbook.SendMail ActiveSheet.Range("a1").Value, _
"test"
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
ActiveWorkbook.Close False
End If
Next sh
Application.ScreenUpdating = True
Thx
Ed