attachment - then email from excel!

D

dj_siek

Hi All!

I have a macro runing outlook. it all works, but I want the file that
is created as a variable - the one sheet of it as below , to be emailed
as the attachment. So its first saved (user in puts the version number),
then that file that is saved is emailed.

CODE:

Private Sub CommandButton1_Click()

variable = InputBox("Please enter a version number", "Version")

Sheets("SCHD").Select
Sheets("SCHD").Copy
ChDir "C:\Documents and Settings\eggenhuizenj\Desktop"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\username\Desktop\Target Refit 2006
Schedule Ver " + variable + ".xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

attach = Windows("Target Refit 2006 Schedule Ver " + variable +
".xls").Activate
ActiveWindow.Close

'Create a new Workbook Containing 1 Sheet _
and sends as attachment.
With ActiveWorkbook
attachment - created above
..SendMail Recipients:="(e-mail address removed)", _
Subject:="Find attached blah " & Format(Date, "dd/mmm/yy")
..Close SaveChanges:=False
End With
End Sub

END CODE


Any help would be greatly appreciated,


thanks!

Joel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top