Results 1 to 5 of 5

Multi-Level Array Type Mismatch Error

Threaded View

  1. #1
    Registered User
    Join Date
    03-31-2009
    Location
    Auburn Alabama
    MS-Off Ver
    Microsoft Office Excel 2007 (Windows)
    Posts
    99

    Multi-Level Array Type Mismatch Error

    Hello,

    When using MsgBox to display the value of a multi-level array, I'm getting run time error 13 for a type mismatch.

    I've included the excel file.

    The problem only occurs when I select a value in the ComboBox labeled "Wd". To select this value, simply click on the toggle button labeled "Wd" and then use the ComboBox and you'll get the error.

    Could you take a look at this for me? I've been debugging for two days now and I've tried changing many things, like, all strings to variants and reassigning different values to the ComboBoxes... still i'm getting the same error.

    If you need to know more about the code, the following is a brief explanation. If not, skip it. But maybe it will answer potential questions.

    Thank you so much for the help!!!!


    The array I've created is 5 levels to begin with. Through a sub-procedure the contents are moved from the 5 level array to a 4 level, 3 level, 2 level, or 1 level array, based on the needs of the user. The user chooses which array he will use (clicking a toggle switch and changing the value of the variable named "Hierarchy".) He then selects an index in that array (by way of a combobox which assigns the value of the combobox to a variable named Ch_1_Box_UserChosen, for example) to obtain its value.

    All levels hold a value of Long except for the bottom level which holds an actual string. However, due to debugging the problem I've described, the string variables are now all declared as variants in my attempt to fix the problem. This created no new problem but fixed nothing as well.

    The problem does not occur when the user selects the 5 level array, the 4 level array, 3 level array, 2 level array, and one of their values. Those values are returned without an error. But when the user selects the single level array, while the value IS displayed correctly, immediately after its shown I get a run time error 13 mismatch.

    The point of all the levels is that they represent a book. The top array is the chapter, then section, then paragraph, then sentence, then word. The user can select a single word by searching for it throught the whole hierarchy of levels or just by going to certain levels.

    For example, The first word in the book can be referenced either by saying: chapter 1 Section 1 Paragraph 1 Sentence 1 Word 1, or by simply saying word 1, since the first word in the book also happens to be the same as the first word in the first chapter in the first paragraph etc. etc.

    This probably sounds confusing but i think the code will make it clear.

    Thanks for taking the time to look at this! It should probably be an easy fix but I'm new to VBA and I can't find the solution for the life of me.

    Thanks again so very much!!!!!!
    Attached Files Attached Files
    Last edited by CrazyFileMaker; 06-03-2009 at 02:01 PM.

Thread Information

Users Browsing this Thread

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

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