+ Reply to Thread
Results 1 to 6 of 6

Parse Word file and evaluate variables

  1. #1
    Registered User
    Join Date
    03-23-2017
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    21

    Parse Word file and evaluate variables

    Dear All,

    I've been facing some Excel macro issues and now realise I should just get it done on my native files format: Word.
    For reference, I've been bothering you with a related Excel query, withh all description available here: https://www.excelforum.com/excel-pro...ompute-it.html

    I’m using tags and will put a space after each > to avoid the ticket to be rejected by the site.

    Summary: I have a Word file containing plenty of variables of the following format: < VMA*>
    VMA is a value to be input by the user (format should be "mm:ss")
    The * is a number between 1 and 500, sometimes followed by a simple operation.
    Examples, let's say user input "05:10" for VMA:
    < VMA70> Should be interpreted as 70% of "05:10", that is, "07:23"
    < VMA100/5> Should be interpreted as "05:10"/5, that is, "01:02"

    I have no skills in VBA and wonder how I could get user input, parse the file, and replace each variable by its computed value.

    Enclosed is a source file I'd like to get working.

    Would you be so kind to look into it?

    Thanks a lot!
    G
    Attached Files Attached Files

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Parse Word file and evaluate variables

    Your description is unclear. It's not at all apparent where the "05:10" comes from, for example (it isn't in the document), or what is supposed to happen with strings like 2x(5x00:30/00:30)+02:00, etc.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    03-23-2017
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    21

    Re: Parse Word file and evaluate variables

    Thanks for your response.

    The "05:10" example is a value input by the user when starting the macro.
    I was thinking about a dialog box where user can just input his value.

    Based on this, all occurrences of < VMA******> need to be calculated in the file.
    If we again assume that user has input "05:10" as "VMA" when initially prompted, the following values should appear in the file:

    2x(5x200m+< VMA100/5>)+02:00 à < VMA100> min/km
    to become:
    2x(5x200m+01:02)+02:00 à 05:10 min/km

    6 à 8x400m+< VMA95/2.5> à < VMA95> min/km
    to become:
    6 à 8x400m+01:58 à 05:26 min/km

    Thanks again

  4. #4
    Registered User
    Join Date
    03-23-2017
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    21

    Re: Parse Word file and evaluate variables

    Up?
    Thank you!

  5. #5
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Parse Word file and evaluate variables

    Try:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-23-2017
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    21

    Re: Parse Word file and evaluate variables

    It DOES work, and manage to study your code to understand it!
    Thanks so much, I’m sincerely grateful!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. parse public variables
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2015, 12:57 PM
  2. Formula to parse first name & surname from cell containing single word
    By mc84excel in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-18-2013, 10:49 PM
  3. How to dynamically-parse text from webpage to variables?
    By amateurmetheus in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-28-2010, 11:54 AM
  4. VBA script to parse string variables in column
    By jlay in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-20-2010, 01:25 PM
  5. Using VBA to Parse Variables from 1 to 3 columns
    By ntallman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-02-2010, 09:59 AM
  6. Replies: 4
    Last Post: 04-24-2006, 07:08 AM
  7. Parse String into Variables
    By Gary''s Student in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-21-2005, 11:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1