C
Cooz
Hi everyone,
In one of our templates an email message is generated by means of code:
....
Set oOApp = CreateObject("Outlook.Application")
Set oOMail = oOApp.CreateItem(olMailItem)
With oOMail
.To = Email
.Subject = "Aanvraagformulier " & docNaam & ".doc"
.Body = ""
.Attachments.Add ActiveDocument.Path & "\" & ActiveDocument
.Send
End With
....
Works fine. When this code executes, the Outlook security dialog pops up as
expected ("A program is trying to automatically send e-mail on your
behalf...") - which is OK. Users are willing to supply one more click.
However, what bothers them, and me, is that this dialog sometimes disappears
behind other windows. The flashing icon on the taskbar that activates the
dialog is easily overlooked - especially with users who have their taskbar
automatically hidden - and Word seems to have stopped responding. This
behavior seems to occur more often when the above code is run more than once
with the same document.
Is there a way to ensure - by means of VBA or otherwise - that this dialog
always appears on top of other windows? Perhaps it is possible to minimize
all open windows before it shows up and restoring them afterwards... - but I
don't know how. Can someone help me out here?
Thank you,
Cooz
(Windows XP, Word 2003, English version)
In one of our templates an email message is generated by means of code:
....
Set oOApp = CreateObject("Outlook.Application")
Set oOMail = oOApp.CreateItem(olMailItem)
With oOMail
.To = Email
.Subject = "Aanvraagformulier " & docNaam & ".doc"
.Body = ""
.Attachments.Add ActiveDocument.Path & "\" & ActiveDocument
.Send
End With
....
Works fine. When this code executes, the Outlook security dialog pops up as
expected ("A program is trying to automatically send e-mail on your
behalf...") - which is OK. Users are willing to supply one more click.
However, what bothers them, and me, is that this dialog sometimes disappears
behind other windows. The flashing icon on the taskbar that activates the
dialog is easily overlooked - especially with users who have their taskbar
automatically hidden - and Word seems to have stopped responding. This
behavior seems to occur more often when the above code is run more than once
with the same document.
Is there a way to ensure - by means of VBA or otherwise - that this dialog
always appears on top of other windows? Perhaps it is possible to minimize
all open windows before it shows up and restoring them afterwards... - but I
don't know how. Can someone help me out here?
Thank you,
Cooz
(Windows XP, Word 2003, English version)