Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6812915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:30:27+00:00 2026-05-26T20:30:27+00:00

I need to read table of data as in picure using vba. I used

  • 0

I need to read table of data as in picure using vba. I used Msg.Body to read the body text but actually i need to find first row as header and rest as data field and update DBMS table accordingly.So is it possible to read the table as I would in excel?
Outlook

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:30:28+00:00Added an answer on May 26, 2026 at 8:30 pm

    This sample procedure should help. I recreated your table in Excel, pasted it into an Outlook email and sent it to myself. Then I used this procedure to read the “cell” values.

    Sub GetLines()
    
    Dim msg As Outlook.mailItem
    Dim rows As Variant
    Dim numberofColumns As Long
    Dim numberofRows As Long
    Dim headerValues As Variant
    Dim headerRow() As String
    Dim data() As String
    Dim i As Long, j As Long
    
    ' get currently selected email
    Set msg = ActiveExplorer.Selection.item(1)
    
    ' tokenize each line of the email
    rows = Split(msg.Body, vbCrLf)
    
    ' calculate array size
    numberofColumns = Len(rows(0)) - Len(Replace(rows(0), Chr(9), ""))
    numberofRows = UBound(rows) + 1
    
    ' put header row into array
    ReDim headerRow(1 To numberofColumns)
    headerValues = Split(rows(0), Chr(9))
    
    For i = 1 To numberofColumns
      headerRow(i) = Trim$(headerValues(i - 1))
    Next i
    
    ' calculate data array size
    numberofRows = numberofRows - 1
    
    ' put data into array
    ReDim data(1 To numberofRows, 1 To numberofColumns)
    
      For i = 1 To numberofRows
        For j = 1 To numberofColumns
          data(i, j) = Trim$(Split(rows(i), Chr(9))(j - 1))
        Next j
      Next i
    
    End Sub
    

    First we tokenize each line of the email into an array. We calculate the array size, then create an array to hold just the first line of the table (the “header”).

    Then we subtract one from the row count because we are going to skip the header row. We then loop through each row, split it and loop through its values, assigning them to our 2D array as we go.

    In the end, the variable “headerRow” can be iterated to retrieve the field values you want to use for your DBMS. The variable “data” contains only the values corresponding to each field. So headerRow(1) and data(n,1) should correspond to the values in the first column of your table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to read data that has been posted to a table before ApplyUpdates
I need to read the data from a table every minute through thread &
i am plotting some data in R using the following commands: jj = ts(read.table(overlap.txt))
I have a database table with a field that I need to read from
I need to read from a variety of different text files (I've some delimited
I need to read data added to the end of an executable from within
I'm familiar with the R data holders like vectors, dataframe, etc. but need to
I need to read in data from excel files in my c# winforms app.
I need to read a table in an Excel file starting from 10th row
I am trying to create an expression tree. I need to read data from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.