AW: PDF aus WebBrowser versenden
29.05.2019 13:43:13
Nepumuk
Hallo,
ich hab den Mailversand auf den CommandButton2 gelegt. Das musst du anpassen:
Option Explicit
Private mvntPath As Variant
Private Sub CommandButton1_Click()
mvntPath = Application.GetOpenFilename("PDF Dateien (*.pdf),*pdf")
If mvntPath <> False Then Call WebBrowser1.Navigate(URL:=mvntPath)
End Sub
Private Sub CommandButton2_Click()
Dim objOutlook As Object, objMail As Object
If VarType(mvntPath) = vbString Then
Set objOutlook = CreateObject(Class:="Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
With objMail
.To = "Mailadresse@Provider.de"
.Subject = "Betreff"
.Body = "Hallo" & vbLf & vbLf & "Im Anhang die Datei" & vbLf & vbLf & "Gruß"
Call .Attachments.Add(mvntPath)
Call .Display ' anzeigen
'call .Send ' direkt senden
End With
Set objMail = Nothing
Set objOutlook = Nothing
Else
Call MsgBox("Keine Datei geladen.", vbExclamation, "Hinweis")
End If
End Sub
Gruß
Nepumuk