ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shname = Array("Sick Graph","Accident Graph") (https://www.excelbanter.com/excel-programming/407532-shname-%3D-array-sick-graph-accident-graph.html)

Steved

Shname = Array("Sick Graph","Accident Graph")
 
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.


JLGWhiz

Shname = Array("Sick Graph","Accident Graph")
 
I assume by "sending" you mean e-mailing. Check out Ron's site.

http://www.rondebruin.nl/sendmail.htm


"Steved" wrote:

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.


Patrick Molloy[_2_]

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

' 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 befo=wb.Worksheets(1)

Next

wb.SendMail "adresss1"

End Sub


"Steved" wrote:

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.


Peter T

Shname = Array("Sick Graph","Accident Graph")
 
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


"Patrick Molloy" wrote in message
...

' 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 befo=wb.Worksheets(1)

Next

wb.SendMail "adresss1"

End Sub


"Steved" wrote:

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.




Steved

Shname = Array("Sick Graph","Accident Graph")
 
Hello from Steved

I thankyou all for your reponses.

"Peter T" wrote:

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


"Patrick Molloy" wrote in message
...

' 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 befo=wb.Worksheets(1)

Next

wb.SendMail "adresss1"

End Sub


"Steved" wrote:

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.






All times are GMT +1. The time now is 12:58 AM.

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