Results 1 to 6 of 6

Thread: Need help with sending message

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Posts
    382

    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.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Posts
    382

    Re: Need help with sending message

    Thanks. Isn't there a way to send a message from an application (Excel) to a particular user?

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Posts
    382

    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.

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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
  •  



Click Here to Expand Forum to Full Width