Gå til hovedindhold

Hvordan sendes kun regneark via Outlook fra Excel?

Hvis du vil e-maile et enkelt regneark ud af en projektmappe i Excel via Outlook, kan du sende regnearket som en vedhæftet fil, som indhold eller som en PDF-fil. Men er der nogen hurtigere måder for dig at håndtere dette problem i Excel?

Send enkelt regneark som brødtekst fra Excel med kommandoen Send til e-mail-modtager

Send enkelt regneark som en vedhæftet fil fra Excel med VBA-kode

Send enkelt regneark som en PDF-fil fra Excel med VBA-kode


pil blå højre boble Send enkelt regneark som brødtekst fra Excel med kommandoen Send til e-mail-modtager

Excel understøtter os til at e-maile det aktive regneark som kropsindhold ved hjælp af kommandoen Send til e-mail-modtager. Du kan gøre som følger:

Hvis du bruger Excel 2007, 2010 eller 2013, skal du tilføje dette Send til e-mail-modtager kommandoen til Hurtig adgangs værktøjslinje først.

1. Klik på ikonet for Tilpas værktøjslinjen Hurtig adgang, og vælg Flere kommandoer, se skærmbillede:

doc-e-mail-ark1

2. Og i Excel-indstillinger dialogboksen, vælg Kommandoer Ikke i båndet i Vælg kommandoer fra på rullelisten, og vælg derefter Send til e-mail-modtager valgmulighed og klik Tilføj >> knappen for at tilføje denne kommando, ved sidste klik OK for at gemme denne indstilling. Se skærmbillede:

doc-e-mail-ark2

3. Send til e-mail-modtager kommandoen er indsat i Hurtig adgangs værktøjslinje, se skærmbillede:

doc-e-mail-ark3

4. Klik derefter på dette Send til e-mail-modtager ikonknap, og der vises en hurtigboks i E-mail hurtigboks, tjek Send det aktuelle ark som meddelelsens brødtekst, og klik OK. Se skærmbillede:

doc-e-mail-ark4

5. Og en e-mail-redigeringsboks vises over regnearkdataene, du kan indtaste dine modtagere, emne og introduktion i det tilsvarende tekstfelt. Se skærmbillede:

doc-e-mail-ark5

6. Klik derefter på Send denne Sheet for at sende dette aktive regneark som beskedtekst til din specifikke person.


pil blå højre boble Send enkelt regneark som en vedhæftet fil fra Excel med VBA-kode

Hvis du vil e-maile det aktive regneark som en vedhæftet fil, kan følgende VBA-kode gøre en tjeneste for dig.

1. Aktivér dit regneark, som du vil sende.

2. Hold nede ALT + F11 tasterne, og det åbner Vinduet Microsoft Visual Basic til applikationer.

3. Klik indsatte > Moduler, og indsæt følgende kode i Modul vindue.

VBA-kode: send det aktuelle regneark som vedhæftet fil fra Excel

Sub SendWorkSheet()
'Update 20131209
Dim xFile As String
Dim xFormat As Long
Dim Wb As Workbook
Dim Wb2 As Workbook
Dim FilePath As String
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
On Error Resume Next
Application.ScreenUpdating = False
Set Wb = Application.ActiveWorkbook
ActiveSheet.Copy
Set Wb2 = Application.ActiveWorkbook
Select Case Wb.FileFormat
Case xlOpenXMLWorkbook:
    xFile = ".xlsx"
    xFormat = xlOpenXMLWorkbook
Case xlOpenXMLWorkbookMacroEnabled:
    If Wb2.HasVBProject Then
        xFile = ".xlsm"
        xFormat = xlOpenXMLWorkbookMacroEnabled
    Else
        xFile = ".xlsx"
        xFormat = xlOpenXMLWorkbook
    End If
Case Excel8:
    xFile = ".xls"
    xFormat = Excel8
Case xlExcel12:
    xFile = ".xlsb"
    xFormat = xlExcel12
End Select
FilePath = Environ$("temp") & "\"
FileName = Wb.Name & Format(Now, "dd-mmm-yy h-mm-ss")
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
Wb2.SaveAs FilePath & FileName & xFile, FileFormat:=xFormat
With OutlookMail
    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "kte features"
    .Body = "Please check and read this document."
    .Attachments.Add Wb2.FullName
    .Send
End With
Wb2.Close
Kill FilePath & FileName & xFile
Set OutlookMail = Nothing
Set OutlookApp = Nothing
Application.ScreenUpdating = True
End Sub

Bemærk: I ovenstående kode kan du ændre følgende oplysninger til dit eget behov.

  • .Til = ""
  • .CC = ""
  • .BCC = ""
  • .Subject = "kte-funktioner"
  • .Body = "Kontroller og læs dette dokument."

4. Klik derefter på F5 nøgle for at køre denne kode, og et promptfelt vises, klik Tillad når statuslinjen er færdig, og derefter er det aktuelle regneark sendt til din modtager som en vedhæftet fil.

doc-e-mail-ark6


pil blå højre boble Send enkelt regneark som en PDF-fil fra Excel med VBA-kode

Nogle gange skal du sende din regnearkrapport til andre, men ikke ønsker, at andre skal ændre den. I dette tilfælde kan du sende regnearket som en PDF-fil fra Excel.

1. Aktivér dit regneark, som du vil sende.

2. Hold nede ALT + F11 tasterne, og det åbner Vinduet Microsoft Visual Basic til applikationer.

3. Klik indsatte > Moduler, og indsæt følgende kode i Modul vindue.

VBA-kode: send det aktuelle regneark som PDF-fil fra Excel

Sub SendWorkSheetToPDF()
'Update 20131209
Dim Wb As Workbook
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
On Error Resume Next
Set Wb = Application.ActiveWorkbook
FileName = Wb.FullName
xIndex = VBA.InStrRev(FileName, ".")
If xIndex > 1 Then FileName = VBA.Left(FileName, xIndex - 1)
FileName = FileName & "_" + ActiveSheet.Name & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
With OutlookMail
    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "kte features"
    .Body = "Please check and read this document."
    .Attachments.Add FileName
    .Send
End With
Kill FileName
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub

Bemærk: I ovenstående kode kan du ændre følgende oplysninger til dit behov.

  • .Til = ""
  • .CC = ""
  • .BCC = ""
  • .Subject = "kte-funktioner"
  • .Body = "Kontroller og læs dette dokument."

4. Tryk derefter på F5 nøgle, og et promptfelt vises, klik på Tillad efter afslutning af statuslinjen, er det aktive regneark sendt til den specifikke person som PDF-fil.

doc-e-mail-ark6

Bemærkninger:

1. Disse metoder er kun tilgængelige, når du bruger Outlook som dit mailprogram.

2. Efter at have sendt det aktuelle regneark, kan du gå til din Outlook for at sikre dig, at e-mailen er sendt med succes.


Opret mailingliste Send derefter e-mails

Kutools til Excel's Opret postliste Send Emails hjælpeprogrammer kan hurtigt oprette postliste i et regneark og derefter sende det samme emne, det samme indhold og de samme vedhæftede filer til flere e-mail-adresser.
doc-postliste 1
dok pil ned
doc-postliste 2

Relaterede artikler:

Hvordan sendes den aktuelle projektmappe via Outlook fra Excel?

Hvordan sendes / e-mail-række celler gennem Outlook fra Excel?

Bedste kontorproduktivitetsværktøjer

🤖 Kutools AI Aide: Revolutionér dataanalyse baseret på: Intelligent udførelse   |  Generer kode  |  Opret brugerdefinerede formler  |  Analyser data og generer diagrammer  |  Aktiver Kutools funktioner...
Populære funktioner: Find, fremhæv eller identificer dubletter   |  Slet tomme rækker   |  Kombiner kolonner eller celler uden at miste data   |   Runde uden formel ...
Super opslag: VLookup med flere kriterier    Multiple Value VLookup  |   VOpslag på tværs af flere ark   |   Fuzzy Lookup ....
Avanceret rulleliste: Opret hurtigt rulleliste   |  Afhængig rulleliste   |  Multivælg rulleliste ....
Column Manager: Tilføj et bestemt antal kolonner  |  Flyt kolonner  |  Skift synlighedsstatus for skjulte kolonner  |  Sammenlign områder og kolonner ...
Fremhævede funktioner: Grid fokus   |  Designvisning   |   Stor Formel Bar    Arbejdsbog & Ark Manager   |  Ressourcebibliotek (Autotekst)   |  Datovælger   |  Kombiner regneark   |  Krypter/Dekrypter celler    Send e-mails efter liste   |  Superfilter   |   Specielt filter (filter fed/kursiv/gennemstreget...) ...
Top 15 værktøjssæt12 tekst Værktøjer (tilføje tekst, Fjern tegn, ...)   |   50 + Chart Typer (Gantt kort, ...)   |   40+ Praktisk formler (Beregn alder baseret på fødselsdag, ...)   |   19 Indsættelse Værktøjer (Indsæt QR-kode, Indsæt billede fra sti, ...)   |   12 Konvertering Værktøjer (Tal til ord, Valutaomregning, ...)   |   7 Flet og del Værktøjer (Avancerede kombinere rækker, Opdel celler, ...)   |   ... og mere

Overlad dine Excel-færdigheder med Kutools til Excel, og oplev effektivitet som aldrig før. Kutools til Excel tilbyder over 300 avancerede funktioner for at øge produktiviteten og spare tid.  Klik her for at få den funktion, du har mest brug for...

Beskrivelse


Fanen Office bringer en grænseflade til et kontor med Office, og gør dit arbejde meget lettere

  • Aktiver redigering og læsning af faner i Word, Excel, PowerPoint, Publisher, Access, Visio og Project.
  • Åbn og opret flere dokumenter i nye faner i det samme vindue snarere end i nye vinduer.
  • Øger din produktivitet med 50 % og reducerer hundredvis af museklik for dig hver dag!
Comments (34)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I've found the code you post for Typhaine and it works very well for me.
So thank's very much.
Philip.
This comment was minimized by the moderator on the site
Bonjour,

Est-il possible d'utiliser le code pour joindre deux feuilles du fichier Excel dans le mail ?

Merci d'avance.
This comment was minimized by the moderator on the site
Hello, Typhaine
To send multiple sheets, please apply the below code:
Note: In the code, you should change the sheet names to your own.
Sub Mail_Sheets_Array()
    Dim FileExtStr As String
    Dim FileFormatNum As Long
    Dim Sourcewb As Workbook
    Dim Destwb As Workbook
    Dim TempFilePath As String
    Dim TempFileName As String
    Dim OutApp As Object
    Dim OutMail As Object
    Dim sh As Worksheet
    Dim TheActiveWindow As Window
    Dim TempWindow As Window
    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With
    Set Sourcewb = ActiveWorkbook
    With Sourcewb
        Set TheActiveWindow = ActiveWindow
        Set TempWindow = .NewWindow
        .Sheets(Array("Sheet1", "Sheet2")).Copy
    End With
    TempWindow.Close
    Set Destwb = ActiveWorkbook
    With Destwb
        If Val(Application.Version) < 12 Then
           
            FileExtStr = ".xls": FileFormatNum = -4143
        Else
            
            Select Case Sourcewb.FileFormat
            Case 51: FileExtStr = ".xlsx": FileFormatNum = 51
            Case 52:
                If .HasVBProject Then
                    FileExtStr = ".xlsm": FileFormatNum = 52
                Else
                    FileExtStr = ".xlsx": FileFormatNum = 51
                End If
            Case 56: FileExtStr = ".xls": FileFormatNum = 56
            Case Else: FileExtStr = ".xlsb": FileFormatNum = 50
            End Select
        End If
    End With
    TempFilePath = Environ$("temp") & "\"
    TempFileName = "Part of " & Sourcewb.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss")

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    With Destwb
        .SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
        On Error Resume Next
        With OutMail
            .To = ""
            .CC = ""
            .BCC = ""
            .Subject = "KTE features"
            .Body = "Please check and read this document"
            .Attachments.Add Destwb.FullName
           
            .Display
        End With
        On Error GoTo 0
        .Close savechanges:=False
    End With
   
    Kill TempFilePath & TempFileName & FileExtStr

    Set OutMail = Nothing
    Set OutApp = Nothing

    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With
End Sub


Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
Hej,

Muszę wysłać zakres (stały) arkusza jako obraz w treści maila jednocześnie dodając cały arkusz jako plik/załącznik. Czy jest to możliwe?
This comment was minimized by the moderator on the site
Hi the program worked just fine till 2021, I tried to run it  today, but it does send the email. As does notshow any errors
This comment was minimized by the moderator on the site
This is to inform you that i have an VBA code for send email from outlook with the help of excel vba,now i want to put "MDD Code" & " MDD Name" as well as Cells(i, 1) & Cells(i, 2) in a table like that.

MDD Code MDD Name
M123 Joydip

I am sending you the VBA Code,Request you for help.
VBA Code
----------------------------------------------------------------------------------------------------------------------------------------------
Sub sendmail()

Dim olapp As Outlook.Application

Dim olmail As Outlook.MailItem

For i = 2 To 35

Application.ScreenUpdating = False

Set olapp = New Outlook.Application

Set olmail = olapp.CreateItem(olMailItem)

With olmail

olmail.To = Cells(i, 4).Value

olmail.CC = Cells(i, 6).Value

olmail.Subject = Cells(i, 7).Value

olmail.HTMLBody = "Dear Partner ," & _

"
Please find the attchment." & _

"

MDD Code : " & Cells(i, 1) & _

"
MDD Name : " & Cells(i, 2) & _

"






Joydip Bhattacharjee" & _

"
Company" & _

"
MIS" & _

"
Country" & _

"
Contact No : 7602066491"







olmail.Attachments.Add Cells(i, 8).Value

'On Error Resume Next

'olmail.Attachments.Add Cells(i, 9).Value

'On Error Resume Next

'olmail.Attachments.Add Cells(i, 10).Value

'On Error Resume Next

'olmail.Attachments.Add Cells(i, 11).Value

'On Error Resume Next

'olmail.Attachments.Add Cells(i, 12).Value

'On Error Resume Next

'olmail.Attachments.Add Cells(i, 13).Value

'On Error Resume Next

'olmail.Attachments.Add Cells(i, 14).Value

'On Error Resume Next

olmail.Send

End With

Set olmail = Nothing

Next

End Sub
This comment was minimized by the moderator on the site
merhaba ben bunu belirli periyotta otomatik mail atmasını nasıl ayarlayabilirim
This comment was minimized by the moderator on the site
Excelent code. Thanks!
This comment was minimized by the moderator on the site
Anyway I can easily send an excel worksheet through my outlook without all this ?? I can send the worksheet context, but no the workbook as an attachment. On my work computer I can send from word and excel, but am having trouble at home.
This comment was minimized by the moderator on the site
Hi! Is it possible to use this code, but instead of sending straight away it opens up the mail?
This comment was minimized by the moderator on the site
You can try this code:
Sub SendWorkSheet()
'Update 20180109
Dim xFile As String
Dim xFormat As Long
Dim Wb As Workbook
Dim Wb2 As Workbook
Dim FilePath As String
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
On Error Resume Next
Application.ScreenUpdating = False
Set Wb = Application.ActiveWorkbook
ActiveSheet.Copy
Set Wb2 = Application.ActiveWorkbook
Select Case Wb.FileFormat
Case xlOpenXMLWorkbook:
xFile = ".xlsx"
xFormat = xlOpenXMLWorkbook
Case xlOpenXMLWorkbookMacroEnabled:
If Wb2.HasVBProject Then
xFile = ".xlsm"
xFormat = xlOpenXMLWorkbookMacroEnabled
Else
xFile = ".xlsx"
xFormat = xlOpenXMLWorkbook
End If
Case Excel8:
xFile = ".xls"
xFormat = Excel8
Case xlExcel12:
xFile = ".xlsb"
xFormat = xlExcel12
End Select
FilePath = Environ$("temp") & "\"
FileName = Wb.Name & Format(Now, "dd-mmm-yy h-mm-ss")
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
Wb2.SaveAs FilePath & FileName & xFile, FileFormat:=xFormat
With OutlookMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "kte features"
.Body = "Please check and read this document."
.Attachments.Add Wb2.FullName
.Display
' .Send
End With
Wb2.Close
Kill FilePath & FileName & xFile
Set OutlookMail = Nothing
Set OutlookApp = Nothing
Application.ScreenUpdating = True
End Sub

Please let me know if it works for you, thank you.
This comment was minimized by the moderator on the site
This code works good, however, does anyone know a way to automate a field as an alert for the email to go automatically based on a date column?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations