|
-
Dec 7th, 2010, 09:35 AM
#1
Thread Starter
Hyperactive Member
Need help with sending message
I've read some about sending an email from and Excel program using VBA and getting around the security prompt - "a program is trying to send ...".
I'm trying to automate an SFTP download using an Excel program. The process works fine when the user starts the Excel program manually. What I would like to do is have the Excel program started automatically as a Windows scheduled task and, when it is finished downloading and processing the data, have it send an email to several users. Using CDO requires a 'From' email address which doesn't exist because it's an application (Excel) that sending.
Is there another way that an email message can be sent?
Thanks.
-
Dec 7th, 2010, 02:43 PM
#2
Re: Need help with sending message
Using CDO requires a 'From' email address which doesn't exist because it's an application (Excel) that sending.
supply a valid from address within the code
if you are using users default smtp settings their default from address, will also be used
their are other ways an email can be sent including automating outlook or downloading vbsendmail
all methods have good and bad points
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Dec 8th, 2010, 10:40 AM
#3
Thread Starter
Hyperactive Member
Re: Need help with sending message
Thanks. Isn't there a way to send a message from an application (Excel) to a particular user?
-
Dec 8th, 2010, 03:48 PM
#4
Re: Need help with sending message
you can try like, but i have never used
thisworkbook.sendmail "[email protected]", "Subject", false
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Dec 8th, 2010, 08:25 PM
#5
Thread Starter
Hyperactive Member
Re: Need help with sending message
That gives the "A program is trying to send" security warning that must be answered. Won't work.
Thanks.
-
Dec 8th, 2010, 09:16 PM
#6
Re: Need help with sending message
use cdo then, it totally works in background, you can either use the default smtp settings or custom settings for one time, there are many examples in this and the vb6 forums
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|