Ifound out myself ... here it is:
Public Sub sendMail(Attach As String, txt As String)
' Her bruges OUTLOOK
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
If Attach <> "" Or txt <> "" Then
On Error GoTo NoOutL
Set MailOutLook = GetCurrentItem ' appOutLook.GetItem(olMailItem)
NoOutL: On Error GoTo 0
If MailOutLook Is Nothing Then
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
End If
With MailOutLook
.BodyFormat = olFormatHTML ' olFormatRichText
.To = ""
.cc = ""
'.bcc = ""
.Subject = "Dokument fra Keld Sørensen"
If txt <> "" Then
.Body = .Body & CrLf(2) & txt ' ellers laver den ikke linieskifte med crLf(1) !!!!!!!!!!
' .HTMLBody = txt
Else
.HTMLBody = "Indtast en besked her !"
End If
If Attach <> "" Then .Attachments.add (Attach)
' .Send ' Her sendes mailen umiddelbart
.Display ' Her vises mailen og du skal selv sende den
End With
Else
MsgBox "Du vil ikke skrive tekst, du vil ikke vedhæfte noget !!" & CrLf(2) & _
"Hvad vil du egentlig ... Ret fejlen og prøv igen !"
End If
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = CreateObject("Outlook.Application")
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
Case Else
' anything else will result in an error, which is
' why we have the error handler above
End Select
Set objApp = Nothing
End Function