Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Detecting whether an email was sent <urgent>


Message #1 by "Charles Jayawardena" <charlesds3@y...> on Wed, 8 May 2002 13:13:19
Hello people,

I have this code that sends emails to clients automatically & I need to 
figure out a way to hold the screen until the first email is sent.

The procedure is as follows:

The email is created automatically with attachments & then displayed on 
the screen for any editing by the user. Then the user presses the 'Send' 
key & then the next email should be displayed automatically to the user. 

What happens now is I have no way of holding the screen when the first 
email is displayed, until the  user presses the 'Send' button for the 
next email to be displayed. All the emails get opened at once & 
the 'Display' displayes them all.

Following is the code that I use. I have to do it in Access 2000.

Please help me on what I should do.

Thanks a lot.

Sudharshan.

Set olookApp = CreateObject("Outlook.Application")

'create the message.
Set olookMsg = olookApp.CreateItem(olMailItem)
    
With olookMsg
  'add the To recipient(s) to the message.
   Sname = rc![Email]
   Set olookRecipient = .Recipients.Add(Sname)
   olookRecipient.Type = olTo
    
   'set the Subject, Body, and Importance of the message.
   .Subject = "This is an Automation test with Microsoft Outlook"
   .Body = "Last test - I promise." & vbCrLf & vbCrLf
'   .Importance = olImportanceHigh  'High importance

   'add attachments to the message.
    If Not IsMissing(AttachmentPath) Then
      Set olookAttach = .Attachments.Add(AttachmentPath)
    End If

    'resolve each Recipient's name
    For Each olookRecipient In .Recipients
      olookRecipient.Resolve
      If Not olookRecipient.Resolve Then
        olookMsg.Display   ' display any names that can't be resolved
      End If
    Next
        
    .Display
        
End With

  Return to Index