VBA - ActiveSheet name as Email Subject

BenGee

Board Regular
Joined
Mar 5, 2016
Messages
179
Code:
With OutMail
            .to = "name@name.co.uk"
            .CC = ""
            .BCC = ""
            .Subject = [COLOR=#ff0000]"Callback For" & Range("F1").Value[/COLOR]
            .Body = "Hi there"
            .Attachments.Add Destwb.FullName

However, the email comes up with no subject. I've also tried;

Code:
[COLOR=#ff0000]"Callback For" & Range("F1").Select[/COLOR]
Code:
[COLOR=#ff0000]"Callback For" & Range("F1")[/COLOR]

I can't see what I'm missing. Any help would be greatly appreciated :)
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Leith Ross

Well-known Member
Joined
Mar 17, 2008
Messages
1,874
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
Hello BenGee,

What error message comes up?
 
Upvote 0

tygrrboi

Well-known Member
Joined
Sep 8, 2015
Messages
1,196
Your post title says you are looking to send the active sheet name as the subject... Is there anything written in F1?


You could try to make a string before hand

Code:
Dim subjectString as String

subjectString = "Callback For " & Range("F1").Value

With OutMail
            .to = "name@name.co.uk"
            .CC = ""
            .BCC = ""
            .Subject = [COLOR=#ff0000]subjectString[/COLOR]
            .Body = "Hi there"
            .Attachments.Add Destwb.FullName

End With
 
Last edited:
Upvote 0

BenGee

Board Regular
Joined
Mar 5, 2016
Messages
179
Thank you tygrrboi & Leith Ross for replying.

I've managed to sort now. The original code did work, it was just the cell the code was referencing contained formula not text. So have now converted this to text.
 
Upvote 0

Forum statistics

Threads
1,191,367
Messages
5,986,246
Members
440,012
Latest member
StumpedGump1987

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top