'command Button 1 - speichern
Private Sub CommandButton2_Click()
Dim xOutlookObj As Object
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Dim rng As Range
Dim strmsg As String
Dim arrymsg()
Dim i As Long
Dim strDesktopPath As String
On Error Resume Next
If IsEmpty(Range("A7")) Then
MsgBox "Enter date"
GoTo ends
Else
If IsEmpty(Range("D7")) Then
MsgBox "Enter Vizrt sales peson"
GoTo ends
Else
If IsEmpty(Range("C9")) Then
MsgBox "Enter the start date of your rental"
GoTo ends
Else
If IsEmpty(Range("C11")) Then
MsgBox "Enter the end date of your rental"
GoTo ends
Else
If IsEmpty(Range("A18")) Then
MsgBox "Please enter a subject line / quote number in cell A18!"
GoTo ends
End If
End If
End If
End If
End If
fPath = "C:\Testpfad\"
fName = ActiveSheet.Range("A18").Value
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fPath & fName & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
ends:
End Sub
'Command Button
Private Sub CommandButton1_Click()
Dim xOutlookObj As Object
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Dim rng As Range
Dim strmsg As String
Dim arrymsg()
Dim i As Long
Dim strDesktopPath As String
On Error Resume Next
If IsEmpty(Range("A7")) Then
MsgBox "Enter date"
GoTo ends
Else
If IsEmpty(Range("D7")) Then
MsgBox "Enter Vizrt sales peson"
GoTo ends
Else
If IsEmpty(Range("C9")) Then
MsgBox "Enter the START DATE of your rental"
GoTo ends
Else
If IsEmpty(Range("C11")) Then
MsgBox "Enter the END DATE of your rental"
GoTo ends
Else
If IsEmpty(Range("A18")) Then
MsgBox "Please enter a subject line / quote number in cell A18!"
GoTo ends
End If
End If
End If
End If
End If
CommandButton2_Click
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.createitem(0)
xMailBody = "Please add any special requirements hereFor FOC rentals - please attach Vanessa's approval to your email." & vbNewLine & vbNewLine & _
"" & vbNewLine & _
""
On Error Resume Next
With xOutMail
.To = "logisticaustria@vizrt.com"
.CC = ""
.BCC = ""
.Subject = "Demopool Request_"
.Body = xMailBody
.Attachments.Add ActiveWorkbook.FullName
.Display 'or use .Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
ends:
End Sub