+ Reply to Thread
Results 1 to 5 of 5

Looking for Shortcut Way to Load Constants to a Two Dimensional Array (MS Word)

  1. #1
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Looking for Shortcut Way to Load Constants to a Two Dimensional Array (MS Word)

    This is for MS-Word (version 2010):
    I want to populate a 2-dim array that is 44 rows and 4 columns with constant values.
    Each array row will have constant values something like:
    1) "long string of text" (string), 2) Priority # (integer), 3) Visibility (boolean), 4) QuickStyle (boolean)

    Is there a shortcut way to load these constants (44x4 or 176 total constants) in this array in a quick way that uses the array function and/or some form of the split function?

    Something like:
    Please Login or Register  to view this content.
    Or, is the only way to do this is thru an i, j two dimensional type loop routine?
    One option: I can visualize loading the 176 constants into a large TEMP one-dimensional array using the split function (visually typed like above with the columns lined up). And, then using an i, j loop to load the two dimensional array and using special math to parse out the values from the TEMP array into the final desired array: {TwoDimArray (i, j) = TEMP_Array((i-1)*4 + j)}. This wouldn't be too busy, but still wondered if all this could be done by using some sort of slick function syntax like above.

    My purpose here is to arrange these constants on the VB page so to make it easy to "see" or understand the arrangement of the constants in the two-dimensional array, as like the example text in the code snippet above. ... Thanks!
    Last edited by sauerj; 12-20-2014 at 03:48 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Looking for Shortcut Way to Load Constants to a Two Dimensional Array (MS Word)

    You could put the data in Excel and initialize the array from there.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,598

    Re: Looking for Shortcut Way to Load Constants to a Two Dimensional Array (MS Word)

    Please Login or Register  to view this content.
    Ben Van Johnson

  4. #4
    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: Looking for Shortcut Way to Load Constants to a Two Dimensional Array (MS Word)

    You could put the array items into a text file, with comma or tab delimiters for the fields, & paragraph breaks for the rows. You can easily read the data in from there. In many respects this is the same as you might do via Excel, except that no automation is needed (you could also use Excel to create the data, then save as a text file, if you prefer).
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Re: Looking for Shortcut Way to Load Constants to a Two Dimensional Array (MS Word)

    Thanks everyone, very helpful!

+ 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. Replies: 6
    Last Post: 09-25-2013, 10:08 PM
  2. Load data to two-dimensional array
    By Mr_Knows_Nothing in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2013, 06:58 PM
  3. Creating a 2-dimensional array from a 1-dimensional list
    By guywithcamera in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-27-2008, 06:34 PM
  4. Load excel range into multi dimensional array
    By Rishi Dhupar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2006, 11:55 AM
  5. [SOLVED] Create One-Dimensional Array from Two-Dimensional Array
    By Stratuser in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2005, 05:06 PM

Tags for this Thread

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