Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you rename a file attachment when you email it

Status
Not open for further replies.

bailey11

Technical User
Jan 18, 2005
103
US
Is there a way to designate the file name (SNP format, as an attachemnt) when you email a report instead of it defaulting to the report name?
 
It sounds like you're using the Docm.SendObject?
If so, I'm not aware how to, if possible.

I use Docmd.OutPutTo to create a file, with the name I choose.
Then I use OutLook automation to send.
 
bailey11,
I have been working on the same thing. did you get an answer that was helpful or figure it out.

OutPutTo will not work for me.

The rewards of the journey far outweigh the risks of leaving the harbor.
 
Why won't OutputTo work?

strFilePath = "C/Docs And Set/WhatEverYouChoose.doc"


DoCmd.OutputTo acReport, "ActualReportName", strFilePath

Dim appOutLook As Outlook.Application, itm As Object

20 Set appOutLook = GetObject(, Outlook.Application)
30 Set itm = appOutLook.CreateItem(olMailItem)


50 With itm
60 .To = "JoeBlo@Wherever.com"
70 .Subject = "Yo Joe!"
80 .Body = ""

100 .Attachments.Add strFilePath
'.Display
120 .sEnd
130 End With

140 Set appOutLook = Nothing
150 Set itm = Nothing

 
Output to will not owrk fo rme because then i am creating 68 or more files that are not needed. I am distributing information on a spreadsheet or as an attached word document and we do not store the spreads or docs on the system because the information is already in the database and that is redundent.

The rewards of the journey far outweigh the risks of leaving the harbor.
 
...One thing I forgot to mention (in lieu of your latest post)


...
100 .Attachments.Add strFilePath
'.Display
120 .sEnd
130 End With

140 Set appOutLook = Nothing
150 Set itm = Nothing

If Dir(strFilePath) <> "" Then Kill strFilePath
 
You could use FileCopy to rename the file, then send the file, then Kill the file you don't want? It's not glamorous, but if your files are not too large it could work pretty well (provided the attached file is specified programmatically)

HTH,

Alex

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top