Results 1 to 4 of 4

Thread: closing outlook object

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    267

    closing outlook object

    i'v created an outlook object (oApp = New Outlook.Application() that will create a new email: oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)

    after the message dialog is started the user has to press send to send the message and close oMsg.. but what happens to oApp? That one is still open right? How can i close this after the user have press send message on the oMsg Dialog? or is oApp closed then oMsg is closed?

  2. #2
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: closing outlook object

    Hi,

    You could try this:

    vb Code:
    1. oApp.Close()

    Just a thought.

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    267

    Re: closing outlook object

    yes, i know that .. but where do i put that? oMsg is closed when the user press yes to send the message. So i cant put it on the end of the code. Can i use an event?

    When i put oApp.Close at the end of the code, oMsg is closed before the users can make an email and sent it.

    oMsg_Close Then oApp.Close something like that

  4. #4
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: closing outlook object

    You don't need to call it explicitly. If you put this code before calling oMsg.Display():

    Code:
    AddHandler oMsg.Unloaded, AddressOf oMsg_Unloaded
    And add this sub to your app:

    Code:
    Private Sub oMsg_Unloaded()
        MessageBox.Show("Unloaded")
    End Sub
    You'll see that the oMsg object is disposed when you close your form.

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