PDA

View Full Version : Solved: How to e-mail 2 worksheets?



felpslima
09-17-2010, 10:37 AM
Hi there, i'm trying to send via a single e-mail, two worksheets (1 and 3) to a specific e-mail.

Currently i'm using a code that sends only one sheet per e-mail.

Can you help me?

What I have right now is:

Sub emailalge()


ThisWorkbook.Sheets(3).Copy


With ActiveWorkbook
.SendMail Recipients:="email@email.com (email@email.com)_
Subject:="e-mail " & Format(Date, "dd/mmm/yy")
.Close SaveChanges:=False
End With

End Sub


thanks!

GTO
09-18-2010, 05:23 AM
Greetings,

Not well tested, try:

In a Standard Module:


Sub exa4()
Dim wbTemp As Workbook

Set wbTemp = Workbooks.Add(xlWBATWorksheet)

With wbTemp
'// NOTE: we are using the worksheets' tab names rather than positions //
ThisWorkbook.Worksheets(Array("MySheet", "MyOtherSheet")).Copy _
After:=.Worksheets(.Worksheets.Count)

Application.DisplayAlerts = False
.Worksheets(1).Delete
Application.DisplayAlerts = True
DoEvents
.SendMail Recipients:="email@email.com", _
Subject:="e-mail " & Format(Date, "dd/mmm/yy")
.Close SaveChanges:=False
End With
End Sub

Hope that helps,

Mark

felpslima
09-20-2010, 04:39 AM
It worked perfectly!!! thank you very much!!!

GTO
09-20-2010, 05:12 AM
Glad to help:friends:

If solved, there is an option under Thread Tools to mark as such. This helps others in not continuing to check the thread if looking to help.

Have a great day:)

Mark