Hi Ken
I have come back this and am still struggling. I am struggling to get the
hWnd for the UserForm. (error: compile error, method or data member not
found). I am struggling to get anything on the internet. The code so far:
Public HWND_TOPMOST As Integer
Public SWP_NOSIZE
Public SWP_NOMOVE
Public SWP_NOACTIVATE
Private Declare Sub setWindowPos Lib "User" (ByVal hWnd As Long, ByVal
hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long,
ByVal cy As Long, ByVal wFlags As Long)
Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objFolder As Outlook.MAPIFolder
Dim oSent As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
WND_TOPMOST = -1
SWP_NOSIZE = &H1
SWP_NOMOVE = &H2
SWP_NOACTIVATE = &H10
If Item.Class = olMail Then
UserForm1.Show
Call setWindowPos(UserForm1.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE
Or SWP_NOMOVE Or SWP_NOACTIVATE)
If answer = "No" Then 'No from UserForm1, I do not want to save the email
On Error Resume Next
Set objNS = Application.GetNamespace("MAPI")
Set oSent = objNS.GetDefaultFolder(olFolderSentMail)
Set objFolder = oSent.Folders("Temp Sent") 'Assume this is a mail
folder
If objFolder Is Nothing Then
MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
"INVALID FOLDER"
End If
If Application.ActiveInspector Is Nothing Then 'Require that this
procedure be called for an open item
Exit Sub
End If
If Application.ActiveInspector.CurrentItem.Class <> olMail Then
Exit Sub
End If
Set Item.SaveSentMessageFolder = objFolder
Set objFolder = Nothing
Set oSent = Nothing
Set objNS = Nothing
End If
End If
End Sub
Your help would be greatly appreciated...