Excel Sub Function Error

  • Hi,

    I am getting an Error while sending Mails. It is showing me Sub or Function not defined.
    Please Help

    Below is the code

  • Re: Excel Sub Function Error

    I am error in rangetoHTML in below code

  • Re: Excel Sub Function Error

    I would recommend setting your .HTMLbody = Email_Body, and then setting your Email_Body to

    Email_Body= "<HTML> <br> </br> </HTML>" & "<html><b>Hi,</b></html>" & "<HTML> <br> </br> </HTML>" _ 
        & " <html><b> " _ 
        & "Please find below summary on Cash Indent and Cash Received.</b></html>" _ 
        & "<HTML> <br> </br> </HTML>" & "<html><b><u> If any discrepancies observed, " _ 
        & "please highlight us for further investigations & rectifications. </b></u> </html>" & _ 
        "<HTML> <br> </br> </HTML>" & rangetoHTML(rng) & "<HTML> <br> </br> </HTML>" & _ 
        "<html><b>Thanks & Regards</b></html>" & "<HTML> <br> </br> </HTML>" & "<b> NCR Corporation (Cash Team) </b>" 

    Then, in your Dim section, set Dim Email_Body As String.

    I have used a similar HTML coding and haven't had any issues. Additionally, since I am not really great with HTML, are the HTML tags (HTML and /HTML) needed? Just an example of the way I use it

    Email_Body = "<b>" & "EXPIRATION NOTIFICATION: " & "</b>" & "<p>" & _            "<p>" & _            "<b><font color=red>" & "***Action required***" & "</font></b>" & "<p>" & _            "<p>" & _            "This is to notify you that Exception " & "<b>" & v2 & "</b>" & " will expire on " & "<b>" & v5 & "</b>" & "." & "<p>" & _            "<p>" & _            w1 & "<p>" & _            w2 & "<p>" & _            w3 & "<b>" & v1 & "</b>" & " (the copy request box will appear to the right of the information you'd normally fill in for a new request)." & "<p>" & _            w4 & " " & "<b>" & ccName & "</b>"

  • Re: Excel Sub Function Error

    Hi Scott,

    Still I am having same Error. Actually I want to copy an excel range and past into the mail body. Please suggest any further modification in code.
    Thanks for your valuable time.

  • Re: Excel Sub Function Error

    So, I haven't worked more on the HTML issue, but I wanted to pass this other on to you. I came across this that will copy a range into an email. It might help get you on the right track.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!