Μετάβαση στο κύριο περιεχόμενο

Πώς να στείλετε / να στείλετε email μέσω κυττάρων μέσω προοπτικών από το Excel;

Είχατε ποτέ πρόβλημα με το ότι αφού ολοκληρώσετε μια αναφορά σε ένα φύλλο εργασίας και πρέπει να στείλετε σε μια σειρά κελιών σε αυτό το φύλλο εργασίας που περιέχουν ορισμένα σημαντικά δεδομένα στον συγκεκριμένο παραλήπτη σας. Υπάρχουν γρήγοροι τρόποι για να στείλετε μέσω ηλεκτρονικού ταχυδρομείου αυτό το εύρος από το Excel χωρίς να ανοίξετε το Outlook;

Αποστολή εύρους κελιών ως συνημμένο από το Excel με κώδικα VBA

Αποστολή εύρους κελιών ως σώμα από το Excel με κωδικό VBA


βέλος μπλε δεξιά φούσκαΑποστολή εύρους κελιών ως συνημμένο από το Excel με κώδικα VBA

Ο ακόλουθος κώδικας VBA μπορεί να σας βοηθήσει να στείλετε το επιλεγμένο εύρος ως συνημμένο στο Excel. Κάντε το ως εξής:

1. Ανοίξτε το βιβλίο εργασίας σας και στη συνέχεια κρατήστε πατημένο το ALT + F11 για να ανοίξετε το Παράθυρο Microsoft Visual Basic for Applications.

2. Κλίκ Κύριο θέμα > Μονάδα μέτρησηςκαι επικολλήστε τον ακόλουθο κώδικα στο Παράθυρο ενότητας.

Κωδικός VBA: αποστολή εύρους κελιών ως συνημμένο από το Excel

Sub SendRange()
'Update 20131209
Dim xFile As String
Dim xFormat As Long
Dim Wb As Workbook
Dim Wb2 As Workbook
Dim Ws As Worksheet
Dim FilePath As String
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
Dim WorkRng As Range
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set Wb = Application.ActiveWorkbook
Wb.Worksheets.Add
Set Ws = Application.ActiveSheet
WorkRng.Copy Ws.Cells(1, 1)
Ws.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 = "information of kte"
    .Body = "hello, 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
Ws.Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

Note: Στον παραπάνω κώδικα, μπορείτε να αλλάξετε τις ακόλουθες πληροφορίες ανάλογα με τις ανάγκες σας.

  • .Προς = ""
  • .CC = ""
  • .BCC = ""
  • .Θέμα = "πληροφορίες του kte"
  • .Body = "γεια, παρακαλώ ελέγξτε και διαβάστε αυτό το έγγραφο."

3. Στη συνέχεια κάντε κλικ στο κουμπί F5 για να εκτελέσετε αυτόν τον κωδικό και θα εμφανιστεί ένα πλαίσιο προτροπής για να σας υπενθυμίσει ότι επιλέγετε ένα εύρος που θέλετε να στείλετε. Δείτε το στιγμιότυπο οθόνης:

doc-send-range1

4. Στη συνέχεια κάντε κλικ στο κουμπί OKκαι θα εμφανιστεί ένα πλαίσιο προτροπής, αφού ολοκληρωθεί η γραμμή προόδου, κάντε κλικ στο Επιτρέψτεκαι στη συνέχεια το συγκεκριμένο εύρος κελιών έχει σταλεί στον παραλήπτη σας ως συνημμένο.

doc-send-range2


βέλος μπλε δεξιά φούσκαΑποστολή εύρους κελιών ως σώμα από το Excel με κωδικό VBA

Εάν θέλετε να στείλετε ένα συγκεκριμένο εύρος ως μέρος του σώματος μηνυμάτων από το Excel, μπορείτε επίσης να εφαρμόσετε τον ακόλουθο κώδικα VBA για να το λύσετε.

Kutools για Excel, με περισσότερα από 120 εύχρηστες λειτουργίες, διευκολύνει τις εργασίες σας. 

1. Ενεργοποιήστε το φύλλο εργασίας σας και κρατήστε πατημένο το ALT + F11 για να ανοίξετε το Παράθυρο Microsoft Visual Basic for Applications.

2. Κλίκ Κύριο θέμα > Μονάδα μέτρησηςκαι επικολλήστε τον ακόλουθο κώδικα στο Παράθυρο ενότητας.

Κωδικός VBA: αποστολή εύρους κελιών ως σώμα από το Excel

Sub EmailRange()
'Update 20131209
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Application.ScreenUpdating = False
WorkRng.Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
    .Introduction = "Please read this email."
    .Item.To = ""
    .Item.Subject = "information of kte"
    .Item.Send
End With
Application.ScreenUpdating = True
End Sub

Σημείωση: Στον παραπάνω κώδικα, μπορείτε να αλλάξετε τις ακόλουθες πληροφορίες ανάλογα με τις ανάγκες σας.

  • . Εισαγωγή = "Διαβάστε αυτό το μήνυμα ηλεκτρονικού ταχυδρομείου."
  • .Item.To = ""
  • .Item.Subject = "πληροφορίες του kte"

3. Στη συνέχεια κάντε κλικ στο κουμπί F5 για να εκτελέσετε αυτόν τον κώδικα και θα εμφανιστεί ένα πλαίσιο προτροπής για να σας υπενθυμίσει ότι επιλέγετε ένα εύρος που θέλετε να στείλετε.

doc-send-range1

4. Στη συνέχεια κάντε κλικ στο κουμπί OKκαι θα εμφανιστεί ένα πλαίσιο προτροπής, αφού ολοκληρωθεί η γραμμή προόδου, κάντε κλικ στο Επιτρέψτεκαι στη συνέχεια το συγκεκριμένο εύρος κελιών έχει σταλεί στον παραλήπτη σας ως σώμα μηνυμάτων.

doc-send-range2

:

1. Αυτοί οι κωδικοί είναι διαθέσιμοι μόνο όταν το Outlook ως πρόγραμμα αλληλογραφίας σας.

2. Μετά την αποστολή του τρέχοντος φύλλου εργασίας, μπορείτε να μεταβείτε στο Outlook για να βεβαιωθείτε ότι το μήνυμα ηλεκτρονικού ταχυδρομείου έχει σταλεί επιτυχώς.


Σχετικά άρθρα:

Πώς να στείλετε φύλλο εργασίας μόνο μέσω του Outlook από το Excel;

Πώς να στείλετε το τρέχον βιβλίο εργασίας μέσω του Outlook από το Excel;

Τα καλύτερα εργαλεία παραγωγικότητας γραφείου

🤖 Kutools AI Aide: Επανάσταση στην ανάλυση δεδομένων με βάση: Ευφυής Εκτέλεση   |  Δημιουργία κώδικα  |  Δημιουργία προσαρμοσμένων τύπων  |  Αναλύστε δεδομένα και δημιουργήστε γραφήματα  |  Επίκληση Λειτουργιών Kutools...
Δημοφιλή χαρακτηριστικά: Εύρεση, επισήμανση ή αναγνώριση διπλότυπων   |  Διαγραφή κενών γραμμών   |  Συνδυάστε στήλες ή κελιά χωρίς απώλεια δεδομένων   |   Γύρος χωρίς φόρμουλα ...
Σούπερ Αναζήτηση: VLookup πολλαπλών κριτηρίων    VLookup πολλαπλών τιμών  |   VLookup σε πολλά φύλλα   |   Ασαφής αναζήτηση ....
Σύνθετη αναπτυσσόμενη λίστα: Γρήγορη δημιουργία αναπτυσσόμενης λίστας   |  Εξαρτημένη αναπτυσσόμενη λίστα   |  Πολλαπλή αναπτυσσόμενη λίστα ....
Διαχειριστής στήλης: Προσθέστε έναν συγκεκριμένο αριθμό στηλών  |  Μετακίνηση στηλών  |  Εναλλαγή κατάστασης ορατότητας κρυφών στηλών  |  Συγκρίνετε εύρη και στήλες ...
Επιλεγμένα Χαρακτηριστικά: Εστίαση πλέγματος   |  Προβολή σχεδίου   |   Μεγάλη Formula Bar    Διαχείριση βιβλίου εργασίας & φύλλου   |  Βιβλιοθήκη πόρων (Αυτόματο κείμενο)   |  Επιλογή ημερομηνίας   |  Συνδυάστε φύλλα εργασίας   |  Κρυπτογράφηση/Αποκρυπτογράφηση κελιών    Αποστολή email ανά λίστα   |  Σούπερ φίλτρο   |   Ειδικό φίλτρο (φίλτρο με έντονη γραφή/πλάγια γραφή/διαγραφή...) ...
Κορυφαία 15 σύνολα εργαλείων12 Κείμενο Εργαλεία (Προσθήκη κειμένου, Κατάργηση χαρακτήρων, ...)   |   50 + Διάγραμμα Τύποι (Gantt διάγραμμα, ...)   |   40+ Πρακτικό ΜΑΘΗΜΑΤΙΚΟΙ τυποι (Υπολογίστε την ηλικία με βάση τα γενέθλια, ...)   |   19 Εισαγωγή Εργαλεία (Εισαγωγή κωδικού QR, Εισαγωγή εικόνας από το μονοπάτι, ...)   |   12 Μετατροπή Εργαλεία (Αριθμοί σε λέξεις, Μετατροπή Συναλλάγματος, ...)   |   7 Συγχώνευση & διαχωρισμός Εργαλεία (Σύνθετες σειρές συνδυασμού, Διαίρεση κελιών, ...)   |   ... κι αλλα

Αυξήστε τις δεξιότητές σας στο Excel με τα Kutools για Excel και απολαύστε την αποτελεσματικότητα όπως ποτέ πριν. Το Kutools για Excel προσφέρει πάνω από 300 προηγμένες δυνατότητες για την ενίσχυση της παραγωγικότητας και την εξοικονόμηση χρόνου.  Κάντε κλικ εδώ για να αποκτήσετε τη δυνατότητα που χρειάζεστε περισσότερο...

Περιγραφή


Το Office Tab φέρνει τη διεπαφή με καρτέλες στο Office και κάνει την εργασία σας πολύ πιο εύκολη

  • Ενεργοποίηση επεξεργασίας και ανάγνωσης καρτελών σε Word, Excel, PowerPoint, Publisher, Access, Visio και Project.
  • Ανοίξτε και δημιουργήστε πολλά έγγραφα σε νέες καρτέλες του ίδιου παραθύρου και όχι σε νέα παράθυρα.
  • Αυξάνει την παραγωγικότητά σας κατά 50% και μειώνει εκατοντάδες κλικ του ποντικιού για εσάς κάθε μέρα!
Comments (27)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi,
Thank you for sharing the code.
How can I re-size the object to make it smaller on the email body?

Thank you so much
This comment was minimized by the moderator on the site
Hi,

I've done everything as above and the result is: all works perfectly apart of the button :) Don't really care about this at the moment :)

Huge thank you!!! topic closed :)
This comment was minimized by the moderator on the site
Thank you for this! I will test it soon as I'll back from holiday. Have one more question. Have an issue with running vba codes by using Activex button (no action at all) even if code works perfectly on edit mode or when run by ctrl+selected button from keyboard. I'm just starting vba journey and have no
idea what I'm doing wrong :/
This comment was minimized by the moderator on the site
Hello, pawerl
You just need to copy and paste the code into the Microsoft Visual Basic for Applications window, and then click the Run button from the tool bar as below screenshot shown: (Note: in the code, S1 is the cell contains the email address that you want to send the email to. Please change them to your need.)

https://www.extendoffice.com/images/stories/comments/comment-skyyang/doc-send-emails.png

Please try again!
This comment was minimized by the moderator on the site
Hej,

Mam plik z 6 arkuszami. Każdy z arkuszy 2-6 musi zostać wysłany do innej grupy odbiorców jako załącznik excela. Czy da się to podpiąć pod 5 przycisków?
This comment was minimized by the moderator on the site
Hello, pawerl
To solve your problem, the below article may help you, please check it:

https://www.extendoffice.com/documents/excel/7178-send-each-sheet-to-different-email.html

Thank you!
This comment was minimized by the moderator on the site
Can we fixed ranges ? in macro its self
This comment was minimized by the moderator on the site
Hello everyone
I have a project to select range in sheet 1 to be sent by email one by one to many emails addresses written in sheet 2 in column A and if column B is empty with a certain subject and after sending he write in sheet 2 column b sent
And to wait time 10 seconds to send the next email as the condition of the server
Any one help me please ?   
This comment was minimized by the moderator on the site
Hi, hriad, " if column B is empty with a certain subject and after sending he write in sheet 2 column b sent
And to wait time 10 seconds to send the next email as the condition of the server" I don't understand this. Please retell me about your requirement.
This comment was minimized by the moderator on the site
Hello Sunny
first of all , thanks for your help , as the server put a condition to not send many emails in the same second , I want to wait 10 seconds after sending first email and the following one.
This comment was minimized by the moderator on the site
Hi, hriad, please try below code, after runing it, it will pop out a dialog for selecting a range which you want to send, then it send to addresses in sheet 2 column A and with the subjects in column B. Every 10 seconds, send to one address. You can change the code "Please read this email" as you need.
<div data-tag="code">Sub SendEmailRange()

'UpdateByExtendoffice20220414

Dim WorkRng As Range

Dim xSU, EV As Boolean

Dim xWSh As Worksheet

Dim xCount As Integer

Dim xI As Integer

On Error Resume Next

xTitleId = "KutoolsforExcel"

'select a range that used to send as body

Set WorkRng = Application.InputBox("Range", xTitleId, Application.Selection.Address, , , , , 8)

If WorkRng Is Nothing Then Exit Sub
WorkRng.Activate
WorkRng.Select

Set xWSh = ActiveWorkbook.Worksheets("Sheet2") 'the sheet that contains addresses and subjects

xCount = xWSh.UsedRange.Rows.Count

xSU = Application.ScreenUpdating

EV = ActiveWorkbook.EnvelopeVisible

Application.ScreenUpdating = False


For xI = 1 To xCount

If (xWSh.Range("A" & xI) = "") Then
Exit For
End If
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Introduction = "Please read this email."

.Item.To = xWSh.Range("A" & xI)

.Item.Subject = xWSh.Range("B" & xI)

.Item.Send
End With
If (xI = xCount) Then

Exit For

End If

Application.Wait Now + TimeValue("0:00:10")

Next


Application.ScreenUpdating = xSU

ActiveWorkbook.EnvelopeVisible = EV

End Sub

This comment was minimized by the moderator on the site
Hello Sunny
Many many Thanks for your effort.... Thanks a lot
This comment was minimized by the moderator on the site
Hello everyone
I have a project to select range in sheet 1 to be sent by email one by one to many emails addresses written in sheet 2 in column A and if column B is empty with a certain subject and after sending he write in sheet 2 column b sent
And to wait time 10 seconds to send the next email as the condition of the server
Any one help me please ?   
This comment was minimized by the moderator on the site
Hi I have a table set up that I want staff to fill in and then a command button that will then automatically generate an email, however I want the data from the table to be in the email body. Is there a code for that? 
Thank you 
This comment was minimized by the moderator on the site
ich möchte das kopierte nicht als Datei in eine E-Mail einfügen, sondern per copy and paste in die E-Mail einfügen. Wie geht das in dem VBA-Code?
This comment was minimized by the moderator on the site
could we put as many email addresses to send to?
This comment was minimized by the moderator on the site
Hi, Carey, all above the VBAs can add many emails address (To, BCC, CC) to send to by using ; as separator. For instance,  .To = "; ; "
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