Change from Envelope to Microsoft Outlok

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
778
Office Version
  1. 365
Hi,

I have the code below to send wire remittance to vendors how can I modify it instead of envelope in excel to open in Outlook instead,

VBA Code:
Sub Send_Range()
Dim cel As Range
   ' Select the range of cells on the active worksheet.
   ActiveSheet.Range("A6:D31").Select
   For Each cel In Range("A10:A18")
    If cel = "" Then cel.EntireRow.Hidden = True
Next
   ' Show the envelope on the ActiveWorkbook.
   ActiveWorkbook.EnvelopeVisible = True
   
   
   ' Set the optional introduction field thats adds
   ' some header text to the email body. It also sets
   ' the To and Subject lines. Finally the message
   ' is sent.
   With ActiveSheet.MailEnvelope
      .Introduction = "Hi" & "  " & ActiveSheet.Range("B3") & "," & vbCrLf & vbCrLf & ActiveSheet.Range("APPLY") & vbCrLf & vbCrLf   '"Please apply the payment to our account or invoice(s) listed below."
      .Item.To = ActiveSheet.Range("B4")
      .Item.CC = ActiveSheet.Range("B5") & ";" & "navigata.ap@distributel.ca"
      .Item.Subject = ActiveSheet.Range("EFT") '"Wire Remittance $"
      .Item.body = ActiveSheet.Range("EFT")
      .Item.Display
      
   End With
   
End Sub

thanks,
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Experiment with this
VBA Code:
Sub Email_It()
    Dim bdY As String
    Dim oApp As Object
    Dim oMail As Object

    Application.ScreenUpdating = False
    '''''''''''Create Body String-----------------------
    For Each cell In Range("A1:A3").Cells
        bdY = bdY & vbCrLf & cell
    Next
    bdY = Right(bdY, Len(bdY) - 2) & vbCrLf & vbCrLf & "You owe " & Range("EFT").Value
    '''''''''''''''''''''''''''''''''---------------------------------
    Set oMail = CreateObject("Outlook.Application").CreateItem(0)
    With oMail
        .To = Range("B4").Value
        .Subject = "Send through out look"
        .body = bdY
        .display
    End With

    Application.ScreenUpdating = True
    Set oMail = Nothing
End Sub
1577006757152.png
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top