ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Subject line in E-mail (https://www.excelbanter.com/excel-programming/288802-subject-line-e-mail.html)

Ola Sigurdh

Subject line in E-mail
 
Hello.

I Found this vba code via a google search which I changed just a little
bit. It does what I want besides that I want it to generate a subject line
in the E-mail that is Avräkning + the worksheet name. How would I do that.
Sub mail()
For a = 1 To ThisWorkbook.Worksheets.Count - 1
With Sheets(Sheets.Count)
Dim MyArr As Variant
MyArr = .Range(.Cells(1, a), .Cells(Rows.Count, a).End(xlUp))
End With
Sheets(a).Copy
ActiveWorkbook.SendMail MyArr, "Avräkning"
ActiveWorkbook.Close False
Next
End Sub

TIA

Ola Sigurdh



Ron de Bruin

Subject line in E-mail
 
Hi Ola

ActiveWorkbook.SendMail MyArr, "Avräkning" & Sheets(a).Name

For other examples see http://www.rondebruin.nl/sendmail.htm


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



"Ola Sigurdh" wrote in message ...
Hello.

I Found this vba code via a google search which I changed just a little
bit. It does what I want besides that I want it to generate a subject line
in the E-mail that is Avräkning + the worksheet name. How would I do that.
Sub mail()
For a = 1 To ThisWorkbook.Worksheets.Count - 1
With Sheets(Sheets.Count)
Dim MyArr As Variant
MyArr = .Range(.Cells(1, a), .Cells(Rows.Count, a).End(xlUp))
End With
Sheets(a).Copy
ActiveWorkbook.SendMail MyArr, "Avräkning"
ActiveWorkbook.Close False
Next
End Sub

TIA

Ola Sigurdh





Ola Sigurdh

Subject line in E-mail
 
Thank´s Ron

I will give it a try now. (Trying to learn some VBA)

Óla Sigurdh


"Ron de Bruin" skrev i meddelandet
...
Hi Ola

ActiveWorkbook.SendMail MyArr, "Avräkning" & Sheets(a).Name

For other examples see http://www.rondebruin.nl/sendmail.htm


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



"Ola Sigurdh" wrote in message

...
Hello.

I Found this vba code via a google search which I changed just a little
bit. It does what I want besides that I want it to generate a subject

line
in the E-mail that is Avräkning + the worksheet name. How would I do

that.
Sub mail()
For a = 1 To ThisWorkbook.Worksheets.Count - 1
With Sheets(Sheets.Count)
Dim MyArr As Variant
MyArr = .Range(.Cells(1, a), .Cells(Rows.Count, a).End(xlUp))
End With
Sheets(a).Copy
ActiveWorkbook.SendMail MyArr, "Avräkning"
ActiveWorkbook.Close False
Next
End Sub

TIA

Ola Sigurdh








All times are GMT +1. The time now is 07:06 AM.

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