+ Reply to Thread
Results 1 to 4 of 4

MailItem.Show

  1. #1
    Registered User
    Join Date
    05-14-2007
    Posts
    46

    MailItem.Show

    Hi

    Using VBA for Excel - Office XP and 2003

    We have an file on a network with a production schedule, that is accessed and modifeid by a couple of users. I am using the Workbook's BeforeSave event to prompt the person who is trying to save the Workbook to send an email to other useds advising them of the changes to the production schedule.
    When I send the mail, I get a pop-up from Outlook saying that another program is tying to send mail, and you then have to click 'Allow for ? Minutes, and say yes. Is there any way to stop this pop-up? I dont mind if the email appears, and the user must click 'Send', but also could not get the code for that. (I.e in the code below, I go myMailItem.Send - I tried myMailItems.Show, but this does not work.

    Is this the best way to create a mail message?

    This is the code I am using:
    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    11-16-2006
    Posts
    80
    This is what I use to send emails automatically:

    Please Login or Register  to view this content.
    Never have any problems, very similar to yours , but use the '.Display' code to show thr email befor sending.

    mccreaso

  3. #3
    Registered User
    Join Date
    05-14-2007
    Posts
    46
    Hi mccreaso

    Thanks for your help - all working fine now!!

    Had a problem with: With objOutlook.CreateItem(olMailItem) - Variable Not Defined

    changed it to: With objOutlook.CreateItem(0)

    The other line that gave a problem: Set oEmail = Nothing

    I don't see where you instantiate oEmail. So just commented that out

    I tried the following, but that never worked either - Got Error: Object Variable or With Block variable not set:

    Please Login or Register  to view this content.
    So just commented out : Set oEmail = Nothing

    Is that bad?

  4. #4
    Registered User
    Join Date
    11-16-2006
    Posts
    80
    When you assign Nothing to an object variable, i.e. "Set oEmail = Nothing", it no longer refers to any object instance. It returns the object to its default value. So its not too bad if you dont set it to nothing! Don't see why you got an error though, but if its not broken dont fix it!!

    HTH,
    mccreaso

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1