Excel - Mail To Function. Wrong Filename??

L

LondonHawk

Thanks in advance for any help you guys can provide.

I'm currently trying to send out information using the Excel - Mail T
- Mail Recipient(as attachment) in a macro. It's all working fine
except that, when the macro attachs the file, it seems to give the fil
a temporary 2 digit name (looks like it could be hexdecimal?!??!
rather than the correct filename.

It's not a massive problem, just I'm getting a lot of e-mails fro
people wondering what I'm sending them!!

Code below................

-
'Saves on C:\ as NewName

ActiveWorkbook.SaveAs Filename:= _
"C:\Headcount\" & NewName & ".xls", FileFormat:= _
xlNormal, Password:="Adam", WriteResPassword:=""
ReadOnlyRecommended:=False _
, CreateBackup:=False

Application.SendKeys "~"

'Sends file and returns to start


Application.Dialogs(xlDialogSendMail).Show
Application.SendKeys UCase(MailName), True
Application.SendKeys "{TAB},{TAB},{TAB},{TAB},{ENTER}"
MailText = "Please find attached your latest headcount data.
Please check and action any errors with HR"
Application.SendKeys (MailText)
Application.SendKeys "%AS"
ActiveWorkbook.Close

-

Cheers, Ada
 

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