• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Autofit in outlook Excel MailEnvelope

Hi Experts,

Im trying to send mail using Mail MailEnvelope but the content is getting wrap after sending the mail like below image.

63031

with my code im able to send mails using MailEnvelope. but excel content and table is getting wropped likw shwon in below picture... please help me to recitfy the same, any help greatly appreciated... thanks in advance
Code:
Sub Sample_MailEnvelope()

Application.ScreenUpdating = False

Sheets("Mail").Visible = True
Dim foliorange As Range

Set foliorange = Sheets("Countsheet").Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)

For Each mycell In foliorange

Worksheets("Mail").Unprotect (".")

Sheets("Mail").Range("A7:B7") = mycell.Offset(0, 2).Value
Sheets("Mail").Range("C7:D7") = mycell.Offset(0, 3).Value
Sheets("Mail").Range("E7:F7") = mycell.Offset(0, 4).Value


  Dim Sendrng As Range

    On Error GoTo StopMacro

    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With


Sheets("Mail").Activate
Range("A1").Select

     Set Sendrng = Selection

    With Sendrng

        ActiveWorkbook.EnvelopeVisible = True
        With .Parent.MailEnvelope

''.Introduction = "Hi," & vbNewLine & vbNewLine & "Kindly note that we have received the following transactions from you today." & vbNewLine & vbNewLine & vbNewLine & vbNewLine & vbNewLine
.Introduction = ""

            With .Item
                .To = mycell.Offset(0, 6).Value    '"sajjanapu.devendra@karvy.com"
                .CC = mycell.Offset(0, 7).Value
                .BCC = ""
                .Subject = "OCBC - IUTA CONFIRMATION"
                .Display
                .send

            End With
        End With
    End With
StopMacro:
    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With
   ActiveWorkbook.EnvelopeVisible = fasle
Next mycell
Worksheets("Mail").Protect "."
Sheets("Mail").Visible = False
Application.ScreenUpdating = True

End Sub


Please help me with the code or any idea how to overcome this wraping problem... i have attached my working file for better understainding.


This is cross post : https://stackoverflow.com/questions/...l-mailenvelope
 

Attachments

  • Sample.xlsm
    26.7 KB · Views: 5
Back
Top