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

Πώς να εφαρμόσετε ένα κουμπί για αποστολή email με συνημμένο το τρέχον αρχείο του Word; 

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

Εφαρμόστε ένα κουμπί για αποστολή email με συνημμένο το τρέχον αρχείο Word


Εφαρμόστε ένα κουμπί για αποστολή email με συνημμένο το τρέχον αρχείο Word

Ακολουθήστε τα παρακάτω βήματα για την επίλυση αυτής της εργασίας στο αρχείο Word:

1. Αρχικά, πρέπει να δημιουργήσετε ένα κουμπί εντολής, κάντε κλικ Εργολάβος > Εργαλεία παλαιού τύπου > Κουμπί εντολών (ActiveX Control), δείτε το στιγμιότυπο οθόνης:

κουμπί doc για αποστολή email 1

2. Επιλέξτε το κουμπί και κάντε κλικ Ιδιοκτησίες σύμφωνα με το Εργολάβος στην καρτέλα Ιδιοκτησίες παράθυρο, πληκτρολογήστε το κείμενο λεζάντας που χρειάζεστε στο Λεζάντα πεδίο, δείτε το στιγμιότυπο οθόνης:

κουμπί doc για αποστολή email 2

3. Στη συνέχεια, κλείστε το Ιδιοκτησίες παράθυρο, τώρα, κάντε δεξί κλικ στο κουμπί και επιλέξτε Προβολή κωδικού, δείτε το στιγμιότυπο οθόνης:

κουμπί doc για αποστολή email 3

4. Και μετά, στην οθόνη Microsoft Visual Basic για εφαρμογές παράθυρο, αντιγράψτε και επικολλήστε τον παρακάτω κώδικα μεταξύ των αρχικών σεναρίων, δείτε το στιγμιότυπο οθόνης:

Dim xOutlookObj As Object
    Dim xEmail As Object
    Dim xDoc As Document
    Application.ScreenUpdating = False
    Set xOutlookObj = CreateObject("Outlook.Application")
    Set xEmail = xOutlookObj.CreateItem(olMailItem)
    Set xDoc = ActiveDocument
    xDoc.Save
    With xEmail
        .Subject = "Fax-data"
        .Body = "This is a test email."
        .To = ""
        .Importance = olImportanceNormal
        .Attachments.Add xDoc.FullName
        .Display
    End With
    Set xDoc = Nothing
    Set xEmail = Nothing
    Set xOutlookObj = Nothing
    Application.ScreenUpdating = True

κουμπί doc για αποστολή email 4

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

5. Στη συνέχεια, αποθηκεύστε και κλείστε αυτόν τον κωδικό, κάντε κλικ στο Λειτουργία σχεδίασης για να απενεργοποιήσετε τη λειτουργία σχεδίασης. Τώρα, όταν κάνετε κλικ στο κουμπί εντολής που έχετε δημιουργήσει, θα δημιουργηθεί ένα μήνυμα ηλεκτρονικού ταχυδρομείου με το τρέχον έγγραφο του Word ως συνημμένο, δείτε το στιγμιότυπο οθόνης:

κουμπί doc για αποστολή email 5

6. Επιτέλους, πρέπει απλώς να κάνετε κλικ Αποστολή κουμπί για να στείλετε αυτό το μήνυμα.

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

Kutools για το Word - Βελτιώστε την εμπειρία σας στο Word με το Over 100 Αξιοσημείωτα χαρακτηριστικά!

🤖 Kutools AI Assistant: Μεταμορφώστε το γραπτό σας με AI - Δημιουργία Περιεχομένου  /  Ξαναγράψτε το κείμενο  /  Συνοψίστε τα έγγραφα  /  Ζητήστε πληροφορίες με βάση το Έγγραφο, όλα μέσα στο Word

📘 Κυριαρχία εγγράφων: Διαίρεση σελίδων  /  Συγχώνευση εγγράφων  /  Εξαγωγή επιλογής σε διάφορες μορφές (PDF/TXT/DOC/HTML...)  /  Μαζική μετατροπή σε PDF  /  Εξαγωγή σελίδων ως εικόνες  /  Εκτύπωση πολλών αρχείων ταυτόχρονα...

Επεξεργασία Περιεχομένων: Μαζική εύρεση και αντικατάσταση σε πολλά αρχεία  /  Αλλαγή μεγέθους όλων των εικόνων  /  Μεταφορά σειρών και στηλών πίνακα  /  Μετατροπή πίνακα σε κείμενο...

🧹 Καθαρισμός χωρίς κόπο: Σαρώστε μακριά Επιπλέον χώροι  /  Διακοπές ενότητας  /  Όλες οι κεφαλίδες  /  Κουτιά κειμένου  /  Υπερ-συνδέσεις  / Για περισσότερα εργαλεία αφαίρεσης, κατευθυνθείτε στο δικό μας Κατάργηση ομάδας...

Δημιουργικά ένθετα: Εισάγετε Χιλιάδες Διαχωριστές  /  Πλαίσια ελέγχου  /  Κουμπιά ραδιοφώνου  /  QR Code  /  barcode  /  Διαγώνιος γραμμικός πίνακας  /  Λεζάντα εξίσωσης  /  Λεζάντα εικόνας  /  Λεζάντα πίνακα  /  Πολλαπλές εικόνες  / Ανακαλύψτε περισσότερα στο Εισαγωγή ομάδας...

🔍 Επιλογές Ακρίβειας: Επισήμανση συγκεκριμένες σελίδες  /  πίνακες  /  σχήματα  /  επικεφαλίδες παραγράφους  / Βελτιώστε την πλοήγηση με περισσότερο Επιλέξτε χαρακτηριστικά...

Βελτιώσεις αστεριών: Πλοηγηθείτε γρήγορα σε οποιαδήποτε τοποθεσία  /  αυτόματη εισαγωγή επαναλαμβανόμενου κειμένου  /  εναλλαγή μεταξύ των παραθύρων εγγράφων  /  11 Εργαλεία μετατροπής...

???? Θέλετε να δοκιμάσετε αυτές τις δυνατότητες; Το Kutools για το Word προσφέρει α Δωρεάν δοκιμαστική περίοδο 60, χωρίς περιορισμούς! 🚀
 
Comments (30)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hey, in my case the button works well but not in a Word document saved with a password. Can somebody help me to fix this?
Best regards
This comment was minimized by the moderator on the site
Hi Skyyang,

I found this works when a user has MS Word but it seems emails like @hotmail; @gmail; and @live email addresses those users have issues where the button doesn't work?
It seems it also doesnt work on smart phones either if the user relies on using these as opposed to a computer.
Lastly I've had a response from another user using Windows 11 where the button doesn't work at all.

What have you experienced with the above examples please?

Thanks,

Mike
This comment was minimized by the moderator on the site
Hi,
Please see the document attached below.
I need to update it for the 2023 renewals use and when merging the button seems to become disabled as several members told me it doesnt work.

Thanks,

Mike
This comment was minimized by the moderator on the site
Hello, Mike,
I have tested your file in my computor, it wors well. I am using Office 2019. Please see the below demo:
https://www.extendoffice.com/images/stories/comments/comment-skyyang/send-doeument.gif
This comment was minimized by the moderator on the site
I have found the button works to open an email but when using mailmerge the VBA button becomes inactive for some reason?
How can I ensure when mailmerging is used the button will work for user to complete the form and then activate the button please?
This comment was minimized by the moderator on the site
Hello, Mike,
When I use mailmerge feature, the button is in active.
Could you explain your problem more detailed?
Or you can upload your file here, so that we can check where the problem is.
Thank you!
This comment was minimized by the moderator on the site
Hi Skyyang,

Please see the post I put in below which has the copy attached.
This comment was minimized by the moderator on the site
Hello folks,

I want to apply a button where I click and send the document as email, not as an attachement, to one Email-Adress. So that the document is the text of the email. Just like the effekt of the button "send to recipient" on the ribbon.

Can someone give me the right code for that?

Thank you.
This comment was minimized by the moderator on the site
Hello,
May be the code can't help to send the current word document as the email body, if to do, the picture and file formatting within the document will be lost.
If you want to send the current document as email body, the Mail Merge can do you a favor.
Do you need the Mail Merge for sending email?
If you need, please comment here.
Thank you!
This comment was minimized by the moderator on the site
Hello,

thank you for your help!

I would try it with your suggestion. Could u give me the code for mail merge?

Thanks!
This comment was minimized by the moderator on the site
Hello,
To send current word document as mail body, you can add the Send to Mail Recipient command to your QAT, please do as this:
1. Open your word file that you want to send, and then click File > Options.
2. On the left pane, select Quick Access Toolbar.
3. Select Commands Not in the Ribbon from the Choose commands from.
4. Choose and select Send to Mail Recipient and click the button Add > >.
5. Click OK to close the dialog.
https://www.extendoffice.com/images/stories/comments/comment-skyyang/doc-send-file-1.png

Now, this Send to Mail Recipient command will show up in the Quick Access Toolbar at the top of your Word window. Then, you can insert the relative information into the message header. After finishing the information, please click Send a copy, the message with current word document as body will be sent at once.

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

Please try this, hope it can help you!
This comment was minimized by the moderator on the site
Hello,

thank you for your help!

I would try it with your suggestion. So yes, I need the Mail Merge for sending E-Mail.
This comment was minimized by the moderator on the site
Hello Heather,

You can add Bcc to this code. For example, you can add .Bcc = "" just below .To = "". So the code becomes:

Dim xOutlookObj As Object
Dim xEmail As Object
Dim xDoc As Document
Application.ScreenUpdating = False
Set xOutlookObj = CreateObject("Outlook.Application")
Set xEmail = xOutlookObj.CreateItem(olMailItem)
Set xDoc = ActiveDocument
xDoc.Save
With xEmail
.Subject = "Fax-data"
.Body = "This is a test email."
.To = ""
.Bcc = ""
.Importance = olImportanceNormal
.Attachments.Add xDoc.FullName
.Display
End With
Set xDoc = Nothing
Set xEmail = Nothing
Set xOutlookObj = Nothing
Application.ScreenUpdating = True

Please see the attached picture. Have a nice day.
Sincerely,
Mandyhttps://www.extendoffice.com/images/stories/comments/comment-zmt/Add_Bcc_to_code.png
This comment was minimized by the moderator on the site
Can you add Bcc to this code? I have tried adding Bcc and receive a compile error for expected expression.
This comment was minimized by the moderator on the site
I have create the document but my issue  now is that if I send this form to say 4 people to complete, when they open it up from the email attachment it opens in read only mode and when they click submit it asks them to save as before it will allow the code to open an email addressed to me. Is there a way around this other than giving them the location of the file?
This comment was minimized by the moderator on the site
Hi Extend office,
Can we set a different email not linked to Outlook? Like direct email to GoDaddy account?
This comment was minimized by the moderator on the site
I am trying to find out the same information. I use gmail and I need to create a form to send out to varies different email address that can automatically submit back to my gmail account.
This comment was minimized by the moderator on the site
Does this also work for Lotus Notes?
What must I change in "xOutlookObj"?
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