Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2002
    Posts
    88

    Unanswered: Close an Applicaton with a Macro?

    I would like to close an applicaton (outlook) with a macro or a macro calling on a function to do this. I also want to later close another applicaiton that is not part of Office.

    I tried:

    Option Compare Database

    Function close_Outlook()
    Dim Outlook As Application
    Outlook.Quit
    End Function

    But that doesn't work.

    I'm working to get around Outook 2002s secuty feature that prompts the user before sending any automatic emails. I want to automate sending a report. I'd like to have it set up to close Outlook, Open Pegasus (another MAPI compliant email program), do a sendobjec command, then close Pegasus and then reopen Outlook.

  2. #2
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251
    generally say, you cannot easily close what you did not open....

    If you open Outlook using code, you can also close it, because you have the Outlook as an object and you just manipulate the object. I had one project where I closed other app using code, it was access2000. I have awesome Access97 in this new office..... so let me try to find it at home.

    You cannot go around security in Outlook. That's why the security is there! There is ONLY ONE way. You can use CDO. It has security patch too, but you can change it (you have to have Exchange server to change the security level!)... See http://www.microsoft.com/Office/ORK/...tsecupdate.htm for more details.

    if you want to send lot of emails, look at another solutions..... there are tons of SMTP APIs.... some of them are free (seach google). The problem here is saving outgoing emails....... with outlook it is automatic. With SMTP API you have to handle it by yourself.



    jiri

  3. #3
    Join Date
    Oct 2002
    Posts
    88
    generally say, you cannot easily close what you did not open....

    If you open Outlook using code, you can also close it, because you have the Outlook as an object and you just manipulate the object. I had one project where I closed other app using code, it was access2000. I have awesome Access97 in this new office..... so let me try to find it at home.

    You cannot go around security in Outlook. That's why the security is there! There is ONLY ONE way. You can use CDO. It has security patch too, but you can change it (you have to have Exchange server to change the security level!)... See http://www.microsoft.com/Office/ORK...utsecupdate.htm for more details.

    If it was up to me that is how we'd do it. The IT department doesn't want to upgrade the Eschage server 2000 at this time.

    if you want to send lot of emails, look at another solutions..... there are tons of SMTP APIs.... some of them are free (seach google). The problem here is saving outgoing emails....... with outlook it is automatic. With SMTP API you have to handle it by yourself.

    I assume you're talking about an email program. I have found one that will work fine for sending the message. I want to continue to use Outlook as my default programs as I use the contact, calendar, etc. I was hoping to just load it and unload outlook for the automation. Maybe I am going to use task scheduler to fire up.

    Thanks

    Tom



    jiri

  4. #4
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251
    SMTP API is not an email program. It is programming interface.You define your SMTP server and it sends email through that server without calling your outlook, netscape, peagasus, lotus notes, ....

    if you send one or two emails, stay with outlook and their API, you will have to click ALLOW when message pops up. If you plan to create app and send hundreds of emails or solution without any pop ups, look at SMTP APIs - it has usually very same object model as your outlook, but it does not use your outlook, it uses only general SMTP server (your or your ISP smtp server) and sends email through it.

    Think about it as a programmer. If you open yahoo mail and hit button SEND, it does not open outlook object, but it calls some kind of SMTP API and sends the email that way..... Yahoo programmers probably created special SMTP API for their servers....



    so it can look like this (see it is almost the same as your outlook) - I made this example, so don't try to run it it will not work...

    Set MySMTP = New SMTPServ
    MySMTP.SMTPServer = "13.2.2.1"

    Set myMessage = MySMTP.Message

    myMessage.To = "jj@gg.com"
    myMessage.Subject = "Hi"
    myMesssage.Body = "This is test"
    myMessage.Send


    most of SMTP APIs are not for free...


    if you would have access to your Win2k Server, you would have access to CDO object model. It is there for server admins and web server programmers and helps them to send email programatically without installing any email program on the server....

    it will look like this (it works ONLY on Win2k server)

    Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    MyCDONTSMail.From= "somebody@nowhere.com"
    MyCDONTSMail.To= "nobody@nowhere.com"
    MyCDONTSMail.Subject="This is a Test"
    MyBody = "Thank you for ordering that stuff" & vbCrLf
    MyBody = MyBody & "We appretiate your business" & vbCrLf
    MyBody = MyBody & "Your stuff will arrive within 7 business days"
    MyCDONTSMail.Body= MyBody
    MyCDONTSMail.Send
    set MyCDONTSMail=nothing



    jiri
    Last edited by playernovis; 12-31-02 at 15:01.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •