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

  • Home
  • SEARCH
  • 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 175647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:44:10+00:00 2026-05-11T13:44:10+00:00

I am now maintaining a legacy VBA/Access 2000 application for a client. They have

  • 0

I am now maintaining a legacy VBA/Access 2000 application for a client. They have a customer who emails orders with text that looks like this

Contact: Peggy Hill Company: Arlen Residential Mortgage Finance Co Address: 43456 South 18939 West, Suite 47995 City: Arlen City ContactState: TX ContactZip: 88888 Phone: 8019990000 Email: peggy.hill@arlenmortgage.com  DateOrdered: 4/6/09 DateDue: 4/15/09 

etc…

The application has a VBA class with all of attributes but no way to parse the data into the appropriate fields. My client wants a form into which they can paste the text out of the email, have it parse to fields for verification and then write to the db.

Issues/Facts:

  1. Each value is set off with ‘ValueName: ‘ token
  2. Depending on how the email clients mangle the string there may or may not be a CrLf at the end of each line.
  3. Missing values will have just the token, no ” or empty space.

I’d like to create a CreateOrder(OrderText As String) function that would read the text from the form but I have no idea how to handle the parsing in VBA.
I started creating a 2D array with the tokens pre-entered, but that seems clunky since I have to read the next item in the array to figure out when to stop accepting data for the previous token.

Suggestions?

  • 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. 2026-05-11T13:44:11+00:00Added an answer on May 11, 2026 at 1:44 pm

    This is fairly minimalistic; please add your own error checking. Need to add a reference to the ‘Microsoft Scripting Runtime’

    Public Function Parse(msg As String) As Dictionary    Dim i As Integer, pos As Integer    Dim line As Variant    Dim lines() As String    Dim dict As New Dictionary     lines = Split(msg, vbCrLf)    For Each line In lines()       pos = InStr(1, line, ':', vbTextCompare)       If pos <> -1 Then         dict.Add Trim$(Left$(line, pos - 1)), Trim$(Right$(line, Len(line) - pos))       End If    Next     Rem: Access values like this (with null checks):    Rem:    dict('Contact'), dict('Address')     Set Parse = dict  End Function 

    I used it by creating a simple form with a textbox and button, and added this to the button click event:

    Private Sub Command2_Click()     Dim dict As Dictionary      Text0.SetFocus     Set dict = Parse(Text0.text)      Debug.Print dict('Contact'), dict('Address')      Rem clear up when done     Set dict = Nothing  End Sub 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been tasked with maintaining a legacy unmanaged c++ system. I do not
I am having a lot of headaches maintaining a website right now. Most often
I've been playing with JQuery UI draggable and have been struggling with maintaining element
I'm maintaining a project that was not initially using a version control system. Instead,
First off let me say I am maintaining someone else's poorly designed code so
I need to build a very simple administration interface for maintaining website content. Not
I'm in the process of re-writing some code whilst maintaining the external interface. The
What is this? This is a collection of questions that come up now and
A Rails/tool specific version of: How deep are your unit tests? Right now, I
I've created an Android application which has a certain package name that I've been

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.