Shname = Array("Sick Graph","Accident Graph")

  • Thread starter Thread starter Steved
  • Start date Start date
S

Steved

Hello From Steved

Shname = Array("Sick Graph")

To This please

Shname = Array("Sick Graph","Accident Graph")

Is it possible please ( Sending 2 worksheets from 1 workbook )
Thankyou.
 
' STANDARD MODULE
Option Explicit
Sub Main()
Dim shNames As Variant
Dim shName As Variant
Dim wb As Workbook
Dim ws As Worksheet


shNames = Array("Sick Graph", "Accident Graph")


Set wb = Workbooks.Add()
For Each shName In shNames
Set ws = ThisWorkbook.Worksheets(shName)
ws.Copy before:=wb.Worksheets(1)

Next

wb.SendMail "adresss1"

End Sub
 
I haven't tried the code but I would have thought you'd end up with
(typically) three additional empty sheets. Of course those could be deleted
but could do this -

Sheets(Array("Sick Graph", "Accident Graph")).Copy
with ActiveWorkbook
..Saveas "NameForTheEmail.xls"
s = .Fullname
..SendMail "adresss1"
..Close false
End With
Kill s

I think it'd better though to follow Ron de Bruin's example in the link
provided by JLGWhiz

To the OP - If those sheets are chart-sheets, or if one or both are
worksheet(s) but do not include all chart source data, you'll need to remove
any links to data in the original workbook before mailing.

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top