Insert a PDF document as an attachment to my e-mail

Maury1704

New Member
Joined
Jan 13, 2016
Messages
24
Hello everyone, my name is Maurizio
and my problem is this:
using the vba I created a procedure that opens my e-mail that sometimes does not have to be (Outlook) and I have already placed the address of the recipient in his place and so far so good.
Then I created a procedure that takes data from sheet1 and more precisely from cell (A11: L23) and creates a pdf document that inserts it into the subdirectory called (Utility) and here everything is OK.
Ahora my question and this: there would be the possibility to take the pdf document and insert it in the email as an attachment?
Thank you so much for all the help you want to give me. Thank you


Attach test file

Links : https://app.box.com/s/zidy0m003eejjjnxqd0q8k2bx9lq4srs
 
The following line seems strange to me. First, file_path already contains "1.pdf1" and you append another "1.pdf1" to it, why? Second, the file is not under Utility directory. Third, there should be no equal sign. ".AddAttachment" is followed by a string.

Code:
        .AddAttachment File_Path[COLOR=#ff0000] =[/COLOR] "\" & Filename
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
<me@gmail.com<me@gmail.com>Hi yKy
Surely the day that we can make it work properly, we will draw a breath of soglievo; Because you are putting it all and that's why I thank you so much.
But when I press the button on the sheet of excel, and true that it gives me no mistake, for here it means that your work is well done.
But besides this (MsgBox ("Reports have been sent.")) Does not do anything.
In fact, it does not even open electronic mail whatever it is.
I also tried to change my Email Address, but also so nothing to do.
What can I still try to do in your opinion?
Thanks Infinite sincere greetings and good evening
</me@gmail.com<me@gmail.com>
 
Upvote 0
It will not open any program. If you have the right userid, password, email address, etc., it'll display the msgbox and that's all you see. The email is sent without any notice. That's why I put a msgbox so I know email has been sent.

Try sending email to you by putting your email address and check your email to see if you get it.
 
Upvote 0
Here you need to put in your account ID and password.
Code:
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[COLOR=#ff0000]mygmailaccount@gmail.com[/COLOR]"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "[COLOR=#ff0000]mypassword[/COLOR]"
Here you need to put in real email addresses. For testing purpose, put in your own email addresses to see if you get all three emails.
Code:
        .To = "[COLOR=#ff0000]recipient@gmail.com[/COLOR]"

        .CC = "[COLOR=#ff0000]recipient1@gmail.com[/COLOR]"

        .BCC = "[COLOR=#ff0000]recipient2@gmail.com[/COLOR]"<myemailaccount@gmail.com><myemailaccount@gmail.com"
<myemailaccount@gmail.com><myemailaccount@gmail.com"
<myemailaccount@gmail.com><myemailaccount@gmail.com"

Here enclose the email address with less than and greater than signs (inside the double quote).<myemailaccount@gmail.com><myemailaccount@gmail.com"
I always do that. Whether it is necessary I'm not sure.
.ReplyTo = "myemailaccount@gmail.com"
.FROM = "myemailaccount@gmail.com"


</myemailaccount@gmail.com"
</myemailaccount@gmail.com></myemailaccount@gmail.com"
</myemailaccount@gmail.com></myemailaccount@gmail.com"
</myemailaccount@gmail.com></myemailaccount@gmail.com"
</myemailaccount@gmail.com>
 
Last edited:
Upvote 0
<me@gmail.com<me@gmail.com>Hi Yky how are you!
Listen: Maybe the Google Translator does not translate to the bottom what I want to tell you about my problem; For now I will try again to explain as simply as possible.


So if you had a look at my project, you would have noticed that it is divided into two parts and have this kind of functions:


1) The first procedure creates a pdf document that leads to the Desktop or wherever you want; Withdrawing data from sheet 1 starting from the cell (A1: J10)


2) The second procedure instead: It takes the Email address of the Recipient that is always in the inserted sheet 1 In the cell (M1) and inserts it in the email page of the Recipient.


Now what I noticed; Not that I want to teach you anything else.
While I have inserted an address where my pdf file I create is deposited.
In your List I do not read anything that says to the procedure itself; Take this document and insert it as an attachment to the email!
That's all !!!!!!!


Maybe that's why it works like it should?


Hello and thanks
</me@gmail.com<me@gmail.com>
 
Upvote 0
You said the first part is already finished. The problem is how to send the PDF as an attachment.

If you can email to yourself using CDO method, the rest is easy. So, try that first to see if you can send email to yourself. If you can send email to yourself, we can go on.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,212
Messages
6,123,656
Members
449,114
Latest member
aides

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top