I hope you don't mind me resurfacing this thread, but I think it applies.
I've been trying to get a button to e-mail a PDF attachment of a pre-determined range. I used the code at
http://www.rondebruin.nl/sendmail.htm and its amazing. I don't understand it much, but it works.
The problem I'm having is it stops to ask for the name of the PDF document. I took the modules from the accompanying spreadsheet (at the website) and Put in the Create PDF module, Create PDF mail module and the Functions Module and set it to a button. Like I said ,it works.
I found the section that has...
'Call the function with the correct arguments
FileName = RDB_Create_PDF(ActiveWorkbook, "", True, True)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(ActiveWorkbook, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
and that's what I wanted to do so I added my path between the quotes.
The problem is it still asks for the file name of the resulting PDF.
When I used F8 to step through the code, it appears to not even hit those lines. (That line appear in a few places.)
If I could go from hitting the button to seeing the e-mail without any other action that would be great.
Other things I want to do is modify the code so its not to hard code with the path. Saving to My documents and over writing is OK, but I need it to work for different users, so it needs to key off of the user name.
Additionally, I would like the e-mail "To" block to pick up an e-mail address from a certain cell.
But as I haven't gotten to not needing the PDF file name yet, I haven't moved on to the dynamic path or dynamic "To" yet.
Any thoughts?
Another related question is, can I just use code under the button? When things start jumping from module to module, I get a little lost. Is there a way to have the code (in the button Private sub) Create the PDF from the range, then attach that to an e-mail message, put in "To" from a cell, put in a subject and canned text and wait for me to click send.
Is there some inherent to sending mail that it needs to be in a module? Or is it because its probable different routines may want that e-mail code and its best to write the code one time and use it many times? All my searches use code in the modules (I was hoping to get it a little simpler).
Thanks for any insight,
Mark