declare variable

K

Kees

I'm using a variable called "name" in my forms code
I want to use this variable also in my Modules code, I tryed several things.
I declared dim, I declared Private, I put the command "Public name As
String" under General declarations.
But when I try to use the variable "name" it want work.
So how can I declare a variable which I can use everywhere and where do I
declare it?

By the way i'm rather new in VBA (as you already know -;) ).

Kees
Kees
 
M

Martin Sägesser

"Kees" <kb-geen said:
I'm using a variable called "name" in my forms code
I want to use this variable also in my Modules code, I tryed several things.
I declared dim, I declared Private, I put the command "Public name As
String" under General declarations.
But when I try to use the variable "name" it want work.
So how can I declare a variable which I can use everywhere and where do I
declare it?

By the way i'm rather new in VBA (as you already know -;) ).

Kees
Kees
Hi Kees

- 'name' is also a property, this is not the problem, but use sName
instead.
- you have to declare the variable under General declarations in a
module and not in the forms code. I don't know why, but it works.

hth, Martin
 
K

Kees

This works,

Thanks,

Kees

"Martin Sägesser" <[email protected]> schreef in bericht
"Kees" <kb-geen said:
I'm using a variable called "name" in my forms code
I want to use this variable also in my Modules code, I tryed several things.
I declared dim, I declared Private, I put the command "Public name As
String" under General declarations.
But when I try to use the variable "name" it want work.
So how can I declare a variable which I can use everywhere and where do I
declare it?

By the way i'm rather new in VBA (as you already know -;) ).

Kees
Kees
Hi Kees

- 'name' is also a property, this is not the problem, but use sName
instead.
- you have to declare the variable under General declarations in a
module and not in the forms code. I don't know why, but it works.

hth, Martin
 

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