Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Public Array (Word 2000 / VBA 6.0)

    Edited by HansV to provide link to MSKB article using <!t>[mskb=170721]<!/t>

    I want to create a two-dimensional array that's defined in a procedure and then used in that procedure and also in the code behind a user form that will be called by that procedure and that will live in the same project. That's the ultimate goal.

    To understand how this should work (especially since my initial efforts did not work), I found specific instructions on microsoft.com at <!mskb=170721>Microsoft Knowledge Base Article 170721<!/mskb>. Method 2 says that I can put

    Public MyArray(1) As String

    in the General Declarations section. When I try to run a test procedure in that module, it chokes on the above line of code in General Declarations with the following error message:

    ***********

    Compile error:

    Constants, fixed-length strings, arrays, user-defined types, and Declare statements not allowed as Public members of object modules.

    ***********

    What am I doing wrong?

    Thank you for your help!

    - Linda

  2. #2
    2 Star Lounger
    Join Date
    Jan 2001
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks, Hans!

    That worked! Thank you for saving my project!

    - Linda

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Public Array (Word 2000 / VBA 6.0)

    You should put the declaration in a module created by Insert | Module, not in a worksheet module, in a userform module or in the ThisDocument module.

Posting Permissions

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