Okay, so you want to save the file first, then retrieve it as attachment to email. Check this thread that shows how to send email with attachment of existing file. http://forums.aspfree.com/microsoft-...ro-447084.html
Okay, so you want to save the file first, then retrieve it as attachment to email. Check this thread that shows how to send email with attachment of existing file. http://forums.aspfree.com/microsoft-...ro-447084.html
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Hi,
I went through the link but could not understand it. Just needed to check as to whether it will work on click of a button, as it is not working. Also since multiple files will be saved in that folder, how this code will work to select the particular file I wish to send.
I think I was not clear in my query, I just want the same file to be mailed and saved, even if it is in a single code and available with a single button. Only a message box before mail comes would come asking for do you wish to send mail, if user clicks yes, than it will attach that file otherwise simply save it.
I know its getting a little messy, but you have been really helpful in all my queries. Kindly let me know in case it is even possible to achieve this.
Thanks a lot.
Aman
What is it you don't understand? What is not working - error message, nothing, wrong results?
Determining the specific file to send would be by input to the procedure. Where the code shows ("path\filename") you could put a reference to a textbox that has the file name as provided by the user. The 'path' could be a fixed value or could also be supplied by user.
.Attachments.add ("C:\Reports\" & Me.textboxname)
As for the message, after saving the pdf:
If MsgBox("Send email with attached report?", vbYesNo) = vbYes Then
'code to send email
End If
All can be done with one button click procedure.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Hi,
I tried it and now it is showing an error " Outlook does not recognize one or more names". I dont know where the problem is as I am using same naming convention for the file saved and file to be mailed.
Aman
Post your entire procedure and/or the database. Does it error on the save or the mail?
I know this code works, it is from my project.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Hi,
I kept on trying, making some modification here and there and it worked. Being a non technical person I was amazed by the way it worked. Awesome was the word that came from my mouth. I could not stop thanking you again and again.
It automatically sends mail and saves it in sent items. However it does not show outlook and the mail. That is one area where I could not work. This would be my last query in relation to this post:
Can I see the mail that is being sent before it starts sending it.
Anyways Thanks a lot. You have made me understand complex technical issues with ease. I am from finance background and had never done any coding prior to this project.
God Bless.
Aman
This code is intended to completely automate sending email. That's what I was after. What happens if you comment out the .Send line? Does Outlook open with the email all ready to go? If so, user will have to click Send on Outlook. Or have user respond to a MsgBox asking if they want to send or cancel. Either way, user must click something to continue.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
What portion shall I remove. Only .send?
Put an apostrophe at beginning of line to comment it. This will not remove the line but it won't execute as code. And yes, just that one line.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I did something like this:
'.Attachments.Add "D:\VendorReport\" & Me.Text6.Value & "VR.pdf"
its not opening and now not sending the mail as well.
Wrong line. Just the .send line.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Changed to this:
.Attachments.Add "D:\VendorReport\" & Me.Text6.Value & "VR.pdf"
'.send
Still not opening.
Yeah, I just did a test and Outlook does not show. So the code runs in background.
Just found something.
Add this just before the '.send line:
.Display
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Hurray.It works. Finally its working as desired.
Thanks once again. I will perform the entire process tomorrow from start till end and will update you.
Thanks a lot.
Aman
Hi,
I ran the complete process on another system and it worked great.
Thanks a lot for all the help.
Aman