Define a public array

H

hsharghi

Hi,

I want to define a Public array of strings in a module, so i can access
the array from my main module. but the compiler gives me this error:
"Constants, fixed-lenght strings, arrays, user-defined types and
Declare statements not allowed as Public members of object modules"
according to Visual Basic Reference an array can be defined as Public.
what's wrong? can anyone help me?

Regards,

Hadi
 
H

hsharghi

hi,
what do you mean by a standard module?
i added a user-form. i ask some data from the user in my new user-form.
and i want to keep themand use them in the main form modul. what should
i do now?

Thanks,

Hadi
 
J

Jezebel

UserForms are a special kind of class. A standard module is what you get if
you add 'Module' to your VBA project.

You could add a public property to your form, that takes an index
argument --

'Module-level variable in the form
Private mData(1 to 10) as string

:

Public Property Get DataValue(Index as long) as string
DataValue = mData(Index)
End Property
 
H

Howard Kaikow

hi,
what do you mean by a standard module?
i added a user-form. i ask some data from the user in my new user-form.
and i want to keep themand use them in the main form modul. what should
i do now?


A userform is a form, not a standard module.
You need to add a module to your project and add the Public statements to
the module.
There need not be any other code in the module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top