Hej
I har denne fine makro. Hvor man mailer en pdf af den excel fane man står på. Kan den laves om så man sender den excel fane man står i som excelfil i stedet for.
Sub LavPDFOgSendViaEmail()
Dim DataSti As String
Dim Filnavn As String
Dim objFolders As Object
Set objFolders = CreateObject("WScript.Shell").SpecialFolders
Dim OutlookPrg As Object
Dim OutlookMail As Object
Set OutlookPrg = CreateObject("Outlook.Application")
Set OutlookMail = OutlookPrg.CreateItem(0)
DataSti = objFolders("desktop") & Application.PathSeparator
Filnavn = ActiveSheet.Name & ".pdf"
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=DataSti & Filnavn, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
On Error Resume Next
With OutlookMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "Hermed fremsendes " & Filnavn
.Body = "Hermed fremsendes " & Filnavn & vbCrLf & vbCrLf & "Med venlig hilsen" & vbCrLf & "Excel-regneark.dk"
.Attachments.Add (DataSti & Filnavn)
.Display
End With
On Error GoTo 0
Kill (DataSti & Filnavn)
Set OutlookMail = Nothing
Set OutlookPrg = Nothing
Set objFolders = Nothing
End Sub