access/outlookexpress messagebox problem

R

Reg

I am opening OutlookExpress from an Access form. Everything works fine and I
can attach files using the following code:
...
If hFile <> 0 Then
If EmailWrite(hFile, Email) Then
RunShellExecute "Open", sTmpFile,
vbNullString,vbNullString,vbNormalFocus
End If
End If
' Wait until Outlook Express is ready
While Ret = 0
DoEvents
Ret = FindWindow(vbNullString, msgTitle)
Wend
zip_file = "D:\test.zip"
SendKeys "%ia" & zip_file & "{TAB}{TAB}{ENTER}"

However if I then add the following line:
confirm = MsgBox("Click ok to set confirmed field ", vbOKCancel,
"Confirm")

the file is not attached and when I close Outlook Express the message box
does not appear.
If I remove the SendKeys line the message box appears when I close Outlook
Express. (The file is obviously not attached)

I would be grateful if someone could explain why this is, and how I can get
a message box to open after I have succesfully attached the file to the
email.

Thanks
Reg
 
Top