Skip to main content

Conas ríomhphost a sheoladh le raon sonraithe a chóipeáil agus a ghreamú isteach sa chomhlacht ríomhphoist in Excel?

In a lán cásanna, d’fhéadfadh go mbeadh réimse sonraithe ábhar i mbileog oibre Excel úsáideach i do chumarsáid ríomhphoist. San Airteagal seo, tabharfaimid isteach modh chun r-phost a sheoladh le pasting raon sonraithe isteach sa chomhlacht ríomhphoist go díreach in Excel.

Seol r-phost le raon sonraithe greamaithe i gcomhlacht ríomhphoist in Excel
Seol r-phost le raon sonraithe greamaithe i gcomhlacht ríomhphoist le huirlis iontach

Tuilleadh ranganna teagaisc le haghaidh postála in Excel ...


Seol r-phost le raon sonraithe greamaithe i gcomhlacht ríomhphoist in Excel

Is féidir leis an gcód VBA seo a leanas cabhrú leat raon a chóipeáil agus a ghreamú i gcomhlacht ríomhphoist Outlook go díreach in Excel. Déan mar a leanas le do thoil.

1. Sa bhileog oibre ina bhfuil an raon a theastaíonn uait a chóipeáil, brúigh an Eile + F11 eochracha ag an am céanna chun an Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

2. 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.

3. 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.

4. cliceáil Ionsáigh > Modúil, ansin cóipeáil agus greamaigh an cód VBA thíos i bhfuinneog an Mhodúil.

Cód VBA: Seol r-phost le raon sonraithe greamaithe i gcomhlacht ríomhphoist in Excel

Sub Send_Email()
'Updated by Extendoffice 20200119
    Dim xRg As Range
    Dim I, J As Long
    Dim xAddress As String
    Dim xEmailBody As String
    Dim xMailOut As Outlook.MailItem
    Dim xOutApp As Outlook.Application    
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Please select range you need to paste into email body", "KuTools For Excel", xAddress, , , , , 8)
If xRg Is Nothing Then Exit Sub
Application.ScreenUpdating = False
    Set xOutApp = CreateObject("Outlook.Application")
    Set xMailOut = xOutApp.CreateItem(olMailItem)
    For I = 1 To xRg.Rows.Count
        For J = 1 To xRg.Columns.Count
            xEmailBody = xEmailBody & "  " & xRg.Cells(I, J).value
        Next
        xEmailBody = xEmailBody & vbNewLine
    Next
    xEmailBody = "Hi" & vbLf & vbLf & " body of message you want to add" & vbLf & vbLf & xEmailBody & vbNewLine
    With xMailOut
        .Subject = "Test"
        .To = ""
        .Body = xEmailBody
        .Display
        '.Send
    End With
    Set xMailOut = Nothing
    Set xOutApp = Nothing
    Application.ScreenUpdating = True
End Sub

nótaí:

  • 1). Athraigh an comhlacht ríomhphoist i líne le do thoil xEmailBody = "Hi" & vbLf & vbLf & "corp na teachtaireachta is mian leat a chur leis" & vbLf & vbLf & xEmailBody & vbNewLine de réir mar is gá duit.
  • 2). Sonraigh d’fhaighteoir ríomhphoist agus d’ábhar le do thoil (.Chun = agus .Subject = "tástáil") línte sa chód.

5. Brúigh an F5 eochair chun an cód a rith. Sa popping suas Kutools le haghaidh Excel bosca dialóige, roghnaigh le do thoil an raon a theastaíonn uait a ghreamú sa chorp ríomhphoist, agus ansin cliceáil ar an OK cnaipe. Féach an pictiúr:

6. Anois cruthaítear r-phost le faighteoir sonraithe, ábhar, comhlacht agus raon Excel roghnaithe, cliceáil le do thoil ar an Seol cnaipe chun an ríomhphost seo a sheoladh. Féach an pictiúr a thaispeántar.

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 le raon sonraithe greamaithe i gcomhlacht ríomhphoist le huirlis iontach

Mura n-úsáideann tú Outlook agus má theastaíonn uait ríomhphoist a sheoladh go díreach in Excel le sonraí raon sonraithe greamaithe taobh istigh, molaim go mór an Seol Ríomhphost fóntais de Kutools le haghaidh Excel duitse. Leis an ngné seo, níl le déanamh agat ach an freastalaí seoladh ríomhphoist atá ag dul as oifig a chumrú, agus ansin ríomhphoist a sheoladh in Excel go díreach tríd an seoladh ríomhphoist seo sa todhchaí.

Roimh iarratas a dhéanamh Kutools le haghaidh Excel, Le do thoil é a íoslódáil agus a shuiteáil ar dtús.

1. Ar dtús, ní mór duit liosta seoltaí a ullmhú le réimsí riachtanacha.

  • Leideanna: Caithfidh 2 shraith ar a laghad a bheith ar an liosta seoltaí, agus caithfidh na ceanntásca a bheith sa chéad tsraith (Má ghlactar leis gur mhaith leat ríomhphoist a sheoladh chuig dhá sheoladh ríomhphoist in Excel, clóscríobh an dá sheoladh ríomhphoist seo le ceannteideal “Ríomhphost” mar a thaispeántar thíos ).
  • Nó is féidir leat liosta seoltaí a chruthú leis an Cruthaigh Liosta Ríomhphoist gné.

2. Roghnaigh an raon a chuirfidh tú na sonraí leis an gcomhlacht ríomhphoist agus brúigh an Ctrl + C eochracha chun é a chóipeáil.

3. Roghnaigh an liosta seoltaí iomlán (cuir ceanntásca san áireamh), cliceáil Kutools Plus > Seol Ríomhphost. Féach an pictiúr:

4. Ansin an Seol Ríomhphost tagann bosca dialóige suas.

  • 4.1) Tá earraí ar an liosta postála roghnaithe líonta i réimsí comhfhreagracha (is féidir leat níos mó réimsí a chur leis an liosta seoltaí de réir mar a theastaíonn uait);
  • 4.2) Cliceáil ar bhosca an choirp ríomhphoist, brúigh an Ctrl + V eochracha chun na sonraí raon roghnaithe a ghreamú isteach ann. Ina dhiaidh sin, cuir ábhar eile de réir mar is gá duit;
  • 4.3 Díthiceáil an Seol ríomhphoist trí Outlook bosca;
  • 2.4) Cliceáil ar an Socruithe Freastalaí Amach cnaipe. Féach an pictiúr:

5. Ansin an Socruithe Freastalaí Amach (SMTP) - Scéim Nua tagann bosca dialóige suas. Líon an seoladh ríomhphoist lena shocruithe freastalaí, sonraigh fillteán chun gach ríomhphost a sheoltar a shábháil tar éis duit an Sábháil ríomhphoist seolta chuig bosca, agus ansin cliceáil ar an OK cnaipe chun na socruithe a shábháil.

6. Nuair a fhillfidh sé ar an Seol Ríomhphost bosca dialóige, cliceáil an Seol cnaipe chun an ríomhphost a sheoladh.

As seo amach, is féidir leat ríomhphoist a sheoladh leis an ngné seo in Excel go díreach.

  Más mian leat triail saor in aisce (30 lá) a bheith agat ar an bhfóntas seo, cliceáil le do thoil chun é a íoslódáil, agus ansin téigh chun an oibríocht a chur i bhfeidhm de réir na gcéimeanna thuas.


Earraí gaolmhara:

Seol r-phost chuig seoltaí ríomhphoist atá sonraithe i gcealla in Excel
Má cheaptar go bhfuil liosta seoltaí ríomhphoist agat, agus gur mhaith leat teachtaireacht ríomhphoist a sheoladh chuig na seoltaí ríomhphoist seo ar an mórchóir go díreach in Excel. Conas é a bhaint amach? Taispeánfaidh an t-alt seo modhanna duit chun ríomhphost a sheoladh chuig seoltaí ríomhphoist iomadúla a shonraítear i gcealla in Excel.

Cuir isteach síniú Outlook agus ríomhphost á sheoladh in Excel
Má theastaíonn uait r-phost a sheoladh go díreach in Excel, conas is féidir leat an síniú réamhshocraithe Outlook a chur leis i do r-phost? Soláthraíonn an t-alt seo dhá mhodh chun cabhrú leat síniú Outlook a chur leis agus ríomhphost á sheoladh in Excel.

Seol r-phost 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 má tá an dáta dlite comhlíonta in Excel
Mar shampla, má tá an dáta dlite i gcolún C níos lú ná nó cothrom le 7 lá (is é an dáta reatha 2017/9/13), ansin meabhrúchán ríomhphoist a sheoladh chuig an bhfaighteoir sonraithe i gcolún A le hábhar sonraithe i gcolún B. Conas é a bhaint amach? Cuirfidh an t-alt seo modh VBA ar fáil chun déileáil leis go mion.

Seol r-phost go huathoibríoch bunaithe ar luach cille in Excel
Má theastaíonn uait ríomhphost a sheoladh trí Outlook chuig faighteoir áirithe bunaithe ar luach cille sonraithe in Excel. Mar shampla, nuair is mó luach cille D7 i mbileog oibre ná 200, cruthaítear r-phost go huathoibríoch. Tugann an t-alt seo modh VBA isteach chun an cheist seo a réiteach go tapa.

Tuilleadh ranganna teagaisc le haghaidh postála in Excel ...

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 (22)
Rated 4.5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
The only issue is that the format of the table is not maintained in the mail. Can you let me know how do we preserve the format of the table in the mail, I have the same issue, could you see if you could update it please, otherwise this is excellent.
Many thanks
Rated 4.5 out of 5
This comment was minimized by the moderator on the site
Hi Andy Mitchell,
If you want to maintain the format of the table, the following VBA script can do you a favor. Please give it a try. Thank you.
Sub Send_Email()
'Updated by Extendoffice 20220616
    Dim xRg As Range
    Dim I, J As Long
    Dim xAddress As String
    Dim xMailOut As Object
    Dim xOutApp As Object
    On Error Resume Next
    Set xOutApp = CreateObject("Outlook.Application")
    Set xMailOut = xOutApp.CreateItem(olMailItem)
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Please select range you need to paste into email body", "KuTools For Excel", xAddress, , , , , 8)
If xRg Is Nothing Then Exit Sub
Application.ScreenUpdating = False
    Set xOutApp = CreateObject("Outlook.Application")
    Set xMailOut = xOutApp.CreateItem(olMailItem)
    With xMailOut
        .Subject = "Test"
        .To = ""
        .HTMLBody = RangetoHTML(xRg)
        .Display
        '.Send
    End With
    Set xMailOut = Nothing
    Set xOutApp = Nothing
    Application.ScreenUpdating = True
End Sub

 ' The following VBA script is cited from this page:
 ' https://stackoverflow.com/questions/18663127/paste-excel-range-in-outlook
Function RangetoHTML(rng As Range)
' By Ron de Bruin.
    Dim fso As Object
    Dim ts As Object
    Dim TempFile As String
    Dim TempWB As Workbook

    TempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm"

    'Copy the range and create a new workbook to past the data in
    rng.Copy
    Set TempWB = Workbooks.Add(1)
    With TempWB.Sheets(1)
        .Cells(1).PasteSpecial Paste:=8
        .Cells(1).PasteSpecial xlPasteValues, , False, False
        .Cells(1).PasteSpecial xlPasteFormats, , False, False
        .Cells(1).Select
        Application.CutCopyMode = False
        On Error Resume Next
        .DrawingObjects.Visible = True
        .DrawingObjects.Delete
        On Error GoTo 0
    End With

    'Publish the sheet to a htm file
    With TempWB.PublishObjects.Add( _
         SourceType:=xlSourceRange, _
         Filename:=TempFile, _
         Sheet:=TempWB.Sheets(1).Name, _
         Source:=TempWB.Sheets(1).UsedRange.Address, _
         HtmlType:=xlHtmlStatic)
        .Publish (True)
    End With

    'Read all data from the htm file into RangetoHTML
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
    RangetoHTML = ts.ReadAll
    ts.Close
    RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _
                          "align=left x:publishsource=")

    'Close TempWB
    TempWB.Close savechanges:=False

    'Delete the htm file we used in this function
    Kill TempFile

    Set ts = Nothing
    Set fso = Nothing
    Set TempWB = Nothing
End Function
This comment was minimized by the moderator on the site
This worked perfectly, thank you so much.
I can now add my spin on it to get it doing what I need.
This comment was minimized by the moderator on the site
Hi Paul Johnson,

Very happy to help you solve the problem. Have a good day at work.
This comment was minimized by the moderator on the site
hello,
can you help me on below
I have create excel sheet & updated 10 supplier mail detailI have send mail through excel to all 10 supplier with individual sheet attachment with individual mail.
I want to paste excel data in outlook body instead of attachment in mail
can any one help me
This comment was minimized by the moderator on the site
Hi,
Instead of selecting the range, I want to select multiple pivots in the excel.
can you please help me.
This comment was minimized by the moderator on the site
Hi,
Instead of selecting the range manually, I want to select the range automatically.
This comment was minimized by the moderator on the site
Hi Raman,
In the below code, please replace the range "A1:C5" in line Set xRg = Range("A1:C5") with your own range.

Sub Send_Email()
Dim xRg As Range
Dim I, J As Long
Dim xAddress As String
Dim xEmailBody As String
Dim xMailOut As Outlook.MailItem
Dim xOutApp As Outlook.Application
On Error Resume Next
xAddress = ActiveWindow.RangeSelection.Address
Set xRg = Range("A1:C5")
If xRg Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Set xOutApp = CreateObject("Outlook.Application")
Set xMailOut = xOutApp.CreateItem(olMailItem)
For I = 1 To xRg.Rows.Count
For J = 1 To xRg.Columns.Count
xEmailBody = xEmailBody & " " & xRg.Cells(I, J).Value
Next
xEmailBody = xEmailBody & vbNewLine
Next
xEmailBody = "Hi" & vbLf & vbLf & " body of message you want to add" & vbLf & vbLf & xEmailBody & vbNewLine
With xMailOut
.Subject = "Test"
.To = ""
.Body = xEmailBody
.Display
'.Send
End With
Set xMailOut = Nothing
Set xOutApp = Nothing
Application.ScreenUpdating = True
End Sub
This comment was minimized by the moderator on the site
Hi experts, Do we have updates on how the format maintained?
This comment was minimized by the moderator on the site
Hi Ther,
Can't figure it out. Sorry for that.
This comment was minimized by the moderator on the site
i am seeing a compile error (User-defined type not defined". Please help me out to overcome this.
This comment was minimized by the moderator on the site
Hi,
Please get into the Reference window by clicking Tools > references. Scroll down to find and check the Microsoft Outlook Object Library box and click the OK button to finish the setting.
This comment was minimized by the moderator on the site
this is pasting as a text. Kindly suggest how to send the table or the same format which is copied from the excel.
This comment was minimized by the moderator on the site
Code to send automatically after selecting after ok
This comment was minimized by the moderator on the site
Hi
This code is vary excellent, by using the code i have completed my 90% of my project.
I have same issue as mentioned by Anirudh that is table formatting. How can i format the table in email.
Please help me......
This comment was minimized by the moderator on the site
Good Day,
The problem can't be solved yet. Sorry for the inconvenience and thank you for your comment.
This comment was minimized by the moderator on the site
Hi, Is there any update on below.......
This comment was minimized by the moderator on the site
Hi, Also I Wanted code for "Filter by Date".
I am working on project, on that project I wanted to filter the data by the date, actually we have filter/hide the and last 05 days to current date data and we have highlight all other data.
Please help me to complete this project.
Your help is very great-full for me.
This comment was minimized by the moderator on the site
This is great. It is working as expected. The only issue is that the format of the table is not maintained in the mail. Can you let me know how do we preserve the format of the table in the mail
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