GranolDad
New Member
- Joined
- Dec 7, 2016
- Messages
- 1
I have the following as a save as macro:
Sub SaveMyPDF()
'
' SaveMyPDF Macro
'
On Error GoTo ende
' First range B5 is client acroynym.
' Second range I4 is one letter.
' Thrid range B3 is name.
' Forth range is WE date.
' Fifth range is file format.
' Should save as example XXX-X-for-John Dow.-WE-112616.pdf
' strFolderPath = "C:\1. Aquitas\Time and Expenses"
' Sheet1.Range("K3").Value & _
Dim strPath As String
Dim strFolderPath As String
strFolderPath = Sheet1.Range("F2").Value
strPath = strFolderPath & _
Sheet1.Range("A2").Value & "-" & _
Sheet1.Range("B2").Value & "-for-" & _
Sheet1.Range("C2").Value & "-WE-" & _
Sheet1.Range("D2").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strPath
ende:
Set app = Nothing
Set itm = Nothing
End Sub
I also have an E-Mail Send macro:
Sub EmailSend()
'
' EmailSend Macro
'
Dim outlookOBJ As Object
Dim mItem As Object
Set outlookOBJ = CreateObject("Outlook.Application")
Set mItem = outlookOBJ.CreateItem(olMailItem)
With mItem
.To = Range("B3").Value
.CC = Range("E3").Value
.Subject = Range("I3").Value
.Body = Range("M3").Value & vbCrLf & vbCrLf & Range("N3")
.Attachments.Add ThisWorkbook.Path & "" & ThisWorkbook.Name
.Send
End With
End Sub
My Question is how can I combine these so an E-Mail is sent with the correct file name and is a PDF?
Is it possible?
Wine a bit
you'll feel better
Sub SaveMyPDF()
'
' SaveMyPDF Macro
'
On Error GoTo ende
' First range B5 is client acroynym.
' Second range I4 is one letter.
' Thrid range B3 is name.
' Forth range is WE date.
' Fifth range is file format.
' Should save as example XXX-X-for-John Dow.-WE-112616.pdf
' strFolderPath = "C:\1. Aquitas\Time and Expenses"
' Sheet1.Range("K3").Value & _
Dim strPath As String
Dim strFolderPath As String
strFolderPath = Sheet1.Range("F2").Value
strPath = strFolderPath & _
Sheet1.Range("A2").Value & "-" & _
Sheet1.Range("B2").Value & "-for-" & _
Sheet1.Range("C2").Value & "-WE-" & _
Sheet1.Range("D2").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strPath
ende:
Set app = Nothing
Set itm = Nothing
End Sub
I also have an E-Mail Send macro:
Sub EmailSend()
'
' EmailSend Macro
'
Dim outlookOBJ As Object
Dim mItem As Object
Set outlookOBJ = CreateObject("Outlook.Application")
Set mItem = outlookOBJ.CreateItem(olMailItem)
With mItem
.To = Range("B3").Value
.CC = Range("E3").Value
.Subject = Range("I3").Value
.Body = Range("M3").Value & vbCrLf & vbCrLf & Range("N3")
.Attachments.Add ThisWorkbook.Path & "" & ThisWorkbook.Name
.Send
End With
End Sub
My Question is how can I combine these so an E-Mail is sent with the correct file name and is a PDF?
Is it possible?
Wine a bit
you'll feel better