Skip to main content

Conas ríomhphost a sheoladh le ceangaltáin iolracha ceangailte in Excel?

Tá an t-alt seo ag caint ar r-phost a sheoladh trí Outlook le ceangaltáin iolracha ceangailte in Excel.

Seol r-phost le ceangaltáin iolracha ceangailte in Excel le cód VBA


Seol r-phost le ceangaltáin iolracha ceangailte in Excel le cód VBA

Déan mar a leanas le do thoil chun ríomhphost a sheoladh le ceangaltáin iolracha ceangailte in Excel.

1. Cuir isteach cnaipe ordaithe trí chliceáil Forbróir > Ionsáigh > Cnaipe Ordú (Rialú ActiveX). Féach an pictiúr:

2. Tar éis duit an Cnaipe Ordú a chur isteach, cliceáil ar dheis air agus roghnaigh Féach an cód ón roghchlár comhthéacs.

3. San oscailt Microsoft Visual Basic d’Fheidhmchláir fuinneog, cliceáil le do thoil uirlisí > tagairtí mar a thaispeántar thíos an pictiúr.

4. Sa Tagairtí - VBAProject bosca dialóige, faigh agus seiceáil an Leabharlann Réada Microsoft Outlook rogha, agus ansin cliceáil ar an OK cnaipe.

5. Ansin cuir an cód VBA faoi bhun an chóid bhunaidh i bhfuinneog an Chóid.

Cód VBA: Seol r-phost ceangailte le ceangaltáin iolracha in Excel

Private Sub CommandButton1_Click()
    Dim xStrFile As String
    Dim xFilePath As String
    Dim xFileDlg As FileDialog
    Dim xFileDlgItem As Variant
    Dim xOutApp As Outlook.Application
    Dim xMailOut As Outlook.MailItem
    Application.ScreenUpdating = False
    Set xOutApp = CreateObject("Outlook.Application")
    Set xMailOut = xOutApp.CreateItem(olMailItem)
    Set xFileDlg = Application.FileDialog(msoFileDialogFilePicker)
    If xFileDlg.Show = -1 Then
        With xMailOut
            .BodyFormat = olFormatRichText
            .To = ""
            .Subject = "test"
            .HTMLBody = "test"
            For Each xFileDlgItem In xFileDlg.SelectedItems
                .Attachments.Add xFileDlgItem
            Next xFileDlgItem
            .Display
        End With
    End If
    Set xMailOut = Nothing
    Set xOutApp = Nothing
    Application.ScreenUpdating = True
End Sub

nótaí: sonraigh d’fhaighteoir ríomhphoist, d’ábhar agus do chorp trí athrú a dhéanamh ar an athróg .Chun = , .Subject = "tástáil" agus .HTMLBody = "tástáil" línte sa chód.

6. Brúigh an Eile + Q eochracha le chéile chun imeacht as an Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

7. cliceáil Forbróir > Mód Dearaidh chun an Mód Dearaidh a mhúchadh. Féach an pictiúr:

8. Cliceáil an Cnaipe Ordú chun an cód a rith. Sa popping suas Brabhsáil fuinneog, roghnaigh na comhaid a chaithfidh tú a cheangal sa ríomhphost, agus ansin cliceáil ar an OK cnaipe. Féach an pictiúr:

9. Ansin cruthaítear r-phost le réimsí agus ceangaltáin shonraithe liostaithe amach. Cliceáil le do thoil ar an Seol cnaipe chun é a sheoladh. Féach an pictiúr:

nótaí: Níl an cód VBA ag obair ach nuair a úsáideann tú Outlook mar do chlár ríomhphoist.


Seol r-phost go héasca trí Outlook bunaithe ar réimsí liosta seoltaí cruthaithe in Excel:

An Seol Ríomhphost fóntais de Kutools le haghaidh Excel cuidíonn sé le húsáideoirí ríomhphost a sheoladh trí Outlook bunaithe ar liosta postála cruthaithe in Excel.
Íoslódáil agus bain triail as anois! (Réalta saor in aisce 30-lá)



Earraí gaolmhara:

Uirlisí Táirgiúlachta Oifige is Fearr

🤖 Kutools AI Aide: anailís sonraí a réabhlóidiú bunaithe ar: Forghníomhú Chliste   |  Gin Cód  |  Cruthaigh Foirmlí Saincheaptha  |  Anailís a dhéanamh ar Sonraí agus Cairteacha a Ghin  |  Feidhmeanna Kutools a agairt...
Gnéithe Coitianta: Faigh, Aibhsigh nó Aithnigh Dúblaigh   |  Scrios Sraitheanna Bána   |  Comhcheangail Colúin nó Cealla gan Sonraí a Chailleadh   |   Babhta gan Foirmle ...
Cuardaigh Super: Ilchritéir VLookup    VLookup Illuachanna  |   VLookup Trasna Ilbhileoga   |   Amharc doiléir ....
Liosta anuas Casta: Go tapa Cruthaigh Liosta Anuas   |  Liosta anuas Cleithiúnach   |  Liosta Buail Isteach Ilroghnacha ....
Bainisteoir Colún: Cuir Líon Sonrach Colún leis  |  Colúin Bog  |  Scoránaigh Stádas Infheictheachta na gColún Ceilte  |  Déan comparáid idir Raonta & Colúin ...
Gnéithe Réadmhaoin: Fócas Eangaí   |  Amharc Dearaidh   |   Barra Mór na Foirmle    Leabhar Oibre & Bainisteoir Bileog   |  Leabharlann Acmhainní (Uaththéacs)   |  Piocálaí Dáta   |  Comhcheangail Bileoga Oibre   |  Criptigh/Díchriptigh Cealla    Seol Ríomhphost trí Liosta   |  Scagaire Super   |   Scagaire Speisialta (scagaire trom/iodálach/stailc tríd...) ...
Barr 15 Uirlisí12 Téacs uirlisí (Cuir Téacs, Bain Carachtair,...)   |   50 + Cairt cineálacha (Cairt Gantt,...)   |   40+ Praiticiúil Foirmlí (Ríomh aois bunaithe ar lá breithe,...)   |   19 Insertion uirlisí (Cuir isteach Cód QR, Ionsáigh Pictiúr ón gCosán,...)   |   12 Tiontú uirlisí (Uimhreacha le Focail, Comhshó Airgeadra,...)   |   7 Cumaisc & Scoilt uirlisí (Sraitheanna Comhcheangail Casta, Cealla Scoilt,...)   |   ... agus eile

Supercharge Do Scileanna Excel le Kutools le haghaidh Excel, agus Éifeachtúlacht Taithí Cosúil Ná Roimhe. Kutools le haghaidh Excel Tairiscintí Níos mó ná 300 Ardghnéithe chun Táirgiúlacht a Treisiú agus Sábháil Am.  Cliceáil anseo chun an ghné is mó a theastaíonn uait a fháil ...

Tuairisc


Tugann Tab Oifige comhéadan Tabbed chuig Office, agus Déan Do Obair i bhfad Níos Éasca

  • Cumasaigh eagarthóireacht agus léamh tabbed i Word, Excel, PowerPoint, Foilsitheoir, Rochtain, Visio agus Tionscadal.
  • Oscail agus cruthaigh cáipéisí iolracha i gcluaisíní nua den fhuinneog chéanna, seachas i bhfuinneoga nua.
  • Méadaíonn do tháirgiúlacht 50%, agus laghdaíonn sé na céadta cad a tharlaíonn nuair luch duit gach lá!
Comments (14)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
أريد إرسال بريد إلكتروني مع البريد أو hotmail مع CDO ولكن كل ما لدي فقط مع مرفق واحد ولكن أريد أن أرسل مع العديد من المرفقات يرجى إرسال لي عن طريق بريدي الإلكتروني الرمز أو ملف Excel
Rated 5 out of 5
This comment was minimized by the moderator on the site
Is het ook mogelijk om een filter te zetten op de selectie van de bijlagen, zodat er alleen pdf-bestanden aan de mail kunnen worden toegevoegd?
This comment was minimized by the moderator on the site
Hi Alex de Graaf,
The code directly calls the Microsoft's file selection window. This makes it easy for VBA users to select needed files.
This comment was minimized by the moderator on the site
Hi Crystal,
Yes, I do understand that. However, is it possible to restrict users to only select pdf-files?
This comment was minimized by the moderator on the site
Hi Crystal,

Yes, I understand that. However I want the users to only be able to select pdf-files.
Is this possible?
This comment was minimized by the moderator on the site
Hi Alex de Graaf,
The following VBA code lists only the PDF files in the Browse window. Please give it a try.

Private Sub CommandButton1_Click()
'Updated by Extendoffice 20220714
    Dim xStrFile As String
    Dim xFilePath As String
    Dim xFileDlg As FileDialog
    Dim xFileDlgItem As Variant
    Dim xOutApp As Outlook.Application
    Dim xMailOut As Outlook.MailItem
    Application.ScreenUpdating = False
    Set xOutApp = CreateObject("Outlook.Application")
    Set xMailOut = xOutApp.CreateItem(olMailItem)
    Set xFileDlg = Application.FileDialog(msoFileDialogFilePicker)
    xFileDlg.Filters.Add "PDF", "*.pdf", 1
xFileDlg.FilterIndex = 1
    If xFileDlg.Show = -1 Then
        With xMailOut
            .BodyFormat = olFormatRichText
            .To = ""
            .Subject = "test"
            .HTMLBody = "test"
            For Each xFileDlgItem In xFileDlg.SelectedItems
                .Attachments.Add xFileDlgItem
            Next xFileDlgItem
            .Display
        End With
    End If
    Set xMailOut = Nothing
    Set xOutApp = Nothing
    Application.ScreenUpdating = True
End Sub
This comment was minimized by the moderator on the site
Hola,
Me gustaría saber como quedaría la macro si quisiera enviar en un mismo correo a varias personas o más y con varios ficheros o más.
Muchas gracias.
This comment was minimized by the moderator on the site
I have enjoyed working through this solution for adding multiple attachments to an email from within Excel VBA. Thank you. I know that a lot of us benefit and then want some aspect customized for exactly what we are trying to do. I am no different, but for step 8. Can we set the path that the Browse window will open with? I can browse over to another folder at a different location but if I could set the path that would be a time saver.
This comment was minimized by the moderator on the site
Superb...... Works perfectly.
This comment was minimized by the moderator on the site
HI Team ....i am unable to see the attachment in mail so if i follow the your step...can you pls help
This comment was minimized by the moderator on the site
the above code works perfectly thanks!! but my email automatic signature seem to disappear with this code. any idea why?
This comment was minimized by the moderator on the site
What if multiple different user and different attachment to be send with different subject line.
This comment was minimized by the moderator on the site
What if above files are located in sub-folders? How to look for a file in folder and sub-folders?
This comment was minimized by the moderator on the site
I am able to "Quickly send email with multiple attachments attached in Excel with Kutools for Excel" using your steps above, but would like to take it one step further and personalize each email by inserting their names (from a column in the Excel sheet) into the body of the email. While in the body of the email, I try selecting the field and clicking on "Insert Placeholder" but nothing happens. Any idea why or how I can fix this? Thank you!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations