If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Excel - Mail To Function. Wrong Filename??
Thanks in advance for any help you guys can provide.
I'm currently trying to send out information using the Excel - Mail To - 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 file 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 from 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, Adam --- Message posted from http://www.ExcelForum.com/ |
#2
|
|||
|
|||
Excel - Mail To Function. Wrong Filename??
Avoid SendKeys
Look here for other examples http://www.rondebruin.nl/sendmail.htm -- Regards Ron de Bruin http://www.rondebruin.nl "LondonHawk " wrote in message ... Thanks in advance for any help you guys can provide. I'm currently trying to send out information using the Excel - Mail To - 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 file 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 from 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, Adam --- Message posted from http://www.ExcelForum.com/ |
#3
|
|||
|
|||
Excel - Mail To Function. Wrong Filename??
Thanks for the tips Ron, will all the code work with Lotus Notes??
Adam --- Message posted from http://www.ExcelForum.com/ |
#4
|
|||
|
|||
Excel - Mail To Function. Wrong Filename??
No
Try CDO http://www.rondebruin.nl/cdo.htm -- Regards Ron de Bruin http://www.rondebruin.nl "LondonHawk " wrote in message ... Thanks for the tips Ron, will all the code work with Lotus Notes?? Adam --- Message posted from http://www.ExcelForum.com/ |
#5
|
|||
|
|||
Excel - Mail To Function. Wrong Filename??
Working much better now - thanks for the assistance
--- Message posted from http://www.ExcelForum.com/ |
Thread Tools | |
Display Modes | |
|
|