A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Excel - Mail To Function. Wrong Filename??



 
 
Thread Tools Display Modes
  #1  
Old June 21st, 2004, 03:51 PM
LondonHawk
external usenet poster
 
Posts: n/a
Default 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  
Old June 21st, 2004, 07:00 PM
Ron de Bruin
external usenet poster
 
Posts: n/a
Default 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  
Old June 22nd, 2004, 08:54 AM
LondonHawk
external usenet poster
 
Posts: n/a
Default 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  
Old June 22nd, 2004, 01:58 PM
Ron de Bruin
external usenet poster
 
Posts: n/a
Default 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  
Old June 22nd, 2004, 02:29 PM
LondonHawk
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.