HTML Body of a Table :


This Function return the HTML Script of any given array ,
Suppose you are trying to send a mail through outlook and want to paste entire table in Mail Body . there you can use this function.
ObjMailItem.HTMLBody=HTMLBody(MyTableArray)
 
Function HTMLBody(InputArray) As String
    ‘==========================================
    ‘Created on 13-Aug
    ‘Return the HTML Script of an Array
    ‘==========================================
    Dim lngRow  As Long
    Dim lngCol  As Long
    Dim StrBody As String
    
    If IsArray(InputArray) Then
        StrBody = “<Body>” & vbCrLf & “<Table Border=1>”
        For lngRow = LBound(InputArray) To UBound(InputArray)
            StrBody = StrBody & “<TR>” & vbCrLf
            For lngCol = LBound(InputArray) To UBound(InputArray, 2)
                StrBody = StrBody & “<TD>” & InputArray(lngRow, lngCol) & “</TD>” & vbCrLf
            Next lngCol
            StrBody = StrBody & “</TR>” & vbCrLf
        Next lngRow
        StrBody = StrBody & “</Table>” & vbCrLf & “</Body>”
        HTMLBody = StrBody
    Else
        HTMLBody = “”
    End If
End Function
Regards
Rajan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s