Hello,
I am trying to write a bit of code to place a file that I have saved within the code as an attachment on a email and extract the address from the file to place in the to box.
this is the code as it stands: -
Sub SaveAndEmail()
Dim NewFN As Variant
NewFN = "O:\Sports Centre\Purchase Order\Copies of Orders\Orders - Sports" & Range("J5").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=NewFN, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Range("J5").Value = Range("j5").Value + 1
Range("C8:D12").ClearContents
Range("G8:J8").ClearContents
Range("B15:H32").ClearContents
Range("D34:E38").ClearContents
ThisWorkbook.Save
Application.Quit
End Sub
also does anyone know if there is a way to select a print within macro coding instead of just sending to the default printer?
I am trying to write a bit of code to place a file that I have saved within the code as an attachment on a email and extract the address from the file to place in the to box.
this is the code as it stands: -
Sub SaveAndEmail()
Dim NewFN As Variant
NewFN = "O:\Sports Centre\Purchase Order\Copies of Orders\Orders - Sports" & Range("J5").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=NewFN, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Range("J5").Value = Range("j5").Value + 1
Range("C8:D12").ClearContents
Range("G8:J8").ClearContents
Range("B15:H32").ClearContents
Range("D34:E38").ClearContents
ThisWorkbook.Save
Application.Quit
End Sub
also does anyone know if there is a way to select a print within macro coding instead of just sending to the default printer?