A common question on this board with a twist

jamesmarcos75

New Member
Joined
Sep 23, 2006
Messages
2
I have set up button in excel that automatically attaches the file to an e-mail and fills out the TO: and SUBJECT: fields. The code is as follows:


Private Sub ClickHereCore_Click()
Application.Dialogs(xlDialogSendMail).Show _
arg1:=Array("name@yahoo.com", "name2@yahoo.com"), _
arg2:="Subject Text"
End Sub

Does anyone no how to amend this code to have the code pull certain text in Cell A1 of the Sheet 1 into the subject field?

Thanks in advance!

Jim
 

Some videos you may like

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453
Hello jamesmarcos75, welcome to the board.
Assuming you mean to use the value of A1 from the active sheet you can simply replace
the line:
arg2:="Subject Text"
with:
arg2:=[A1].Value

Otherwise you'll want to specify the sheet by name...
arg2:=Sheets("Sheet1").[A1].Value
 

Watch MrExcel Video

Forum statistics

Threads
1,114,525
Messages
5,548,558
Members
410,849
Latest member
DannyNg
Top