Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default global or local intializing ??

i'm workin' with VBE (visual basic excel).

i've several userforms linked one with the other
in each object of the userforms (command buttons i.e.) i've writed some
lines of code.
i use many local variables as indexes for my cycles.
I HAVE NOT initialized none of them and on my PC everything works right
!

i've send my file to one of my testers and he told me he can't run
macros involved because variables are not initialized.

1st question: how could that be possible ?? maybe different version of
VB &/or EXCEL ??

2nd question: how could i initialize all variables without acting in
EVERY SINGLE button containing a cycle or a local VARIABLE ?

3rd question: is it possible to declare all variables involved once in
a time? (i.e. launchin a macro that declare all variables kind makin
them acting as GLOBAL VARIABLES)

really thanks 4 answering!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default global or local intializing ??

Excel automatically initializes variables to a default value.

It sounds like the tester has not communicated the exact error. Perhaps
they have put option explicit in the module and excel is complaining that
the variables have not been declared. If this is the case, you would need
to either remove the option explicit declaration or declare the variables.

Global or Local should not be an issue in resolving this.

--
Regards,
Tom Ogilvy


"furbiuzzu" wrote in message
oups.com...
i'm workin' with VBE (visual basic excel).

i've several userforms linked one with the other
in each object of the userforms (command buttons i.e.) i've writed some
lines of code.
i use many local variables as indexes for my cycles.
I HAVE NOT initialized none of them and on my PC everything works right
!

i've send my file to one of my testers and he told me he can't run
macros involved because variables are not initialized.

1st question: how could that be possible ?? maybe different version of
VB &/or EXCEL ??

2nd question: how could i initialize all variables without acting in
EVERY SINGLE button containing a cycle or a local VARIABLE ?

3rd question: is it possible to declare all variables involved once in
a time? (i.e. launchin a macro that declare all variables kind makin
them acting as GLOBAL VARIABLES)

really thanks 4 answering!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default global or local intializing ??

thanks for today's and yesterday's answer. i'm new of this forum and
i'm learning just now how to act with.

i've checked in my VB options and the option "obligaotry variables
declaration" (i don't know if it's the correct translation from italian
to english) was De-activated.

maybe my tester has this option checked and so things doesn't work
right ?
if it is so, there's a way to deactivate this option inside the file??

i've to publish it and i want my options be common

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default global or local intializing ??

Hi

Those settings follow the code modules, not the user or the computer. So
whatever works at your place works at your tester's place, unless (s)he did
something to it.

This said, I think you should declare all your variables. Anyone blessed
with the gift of a personal software tester should declare variables in
sheer gratitude and give them cool hungarian names :-)

Best wishes Harald

"furbiuzzu" skrev i melding
oups.com...
thanks for today's and yesterday's answer. i'm new of this forum and
i'm learning just now how to act with.

i've checked in my VB options and the option "obligaotry variables
declaration" (i don't know if it's the correct translation from italian
to english) was De-activated.

maybe my tester has this option checked and so things doesn't work
right ?
if it is so, there's a way to deactivate this option inside the file??

i've to publish it and i want my options be common



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default global or local intializing ??

ahahaha , i don't know hungarian names....
if you post me here some of them, surely i'll name my variables this
way.

i agree with your worda but the fact is i have more than 50 command
button in a userform and i don't want to declare all variables, now,
inside each of them !
the fact i didn't understand is: why it works fine on my PC and it
doesn't in another one?

the solution i found is to write, before any Sub / function, in
related userform code page these lines:

Public I As Variant
Public capt As Integer
Public cbuttonindex As Integer
Public row As Integer

do you think it will work?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default global or local intializing ??

Yes, that should work.

--
Regards,
Tom Ogilvy

"furbiuzzu" wrote in message
oups.com...
ahahaha , i don't know hungarian names....
if you post me here some of them, surely i'll name my variables this
way.

i agree with your worda but the fact is i have more than 50 command
button in a userform and i don't want to declare all variables, now,
inside each of them !
the fact i didn't understand is: why it works fine on my PC and it
doesn't in another one?

the solution i found is to write, before any Sub / function, in
related userform code page these lines:

Public I As Variant
Public capt As Integer
Public cbuttonindex As Integer
Public row As Integer

do you think it will work?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default global or local intializing ??

YESS !

tested, it works fine :-) !
really thanks everybody !

i'm waitng for hungarian names from harald now ! :))

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default global or local intializing ??

http://support.microsoft.com/default...b;en-us;110264
INFO: Microsoft Consulting Services Naming Conventions for Visual Basic



http://support.microsoft.com/default...b;en-us;173738
INFO: Object Hungarian Notation Naming Conventions for VB


--
Regards,
Tom Ogilvy



"furbiuzzu" wrote in message
oups.com...
YESS !

tested, it works fine :-) !
really thanks everybody !

i'm waitng for hungarian names from harald now ! :))



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default global or local intializing ??

Thanks Tom. A few hours offline & dining here in Norway.

Best wishes Harald

"Tom Ogilvy" skrev i melding
...
http://support.microsoft.com/default...b;en-us;110264
INFO: Microsoft Consulting Services Naming Conventions for Visual

Basic



http://support.microsoft.com/default...b;en-us;173738
INFO: Object Hungarian Notation Naming Conventions for VB


--
Regards,
Tom Ogilvy



"furbiuzzu" wrote in message
oups.com...
YESS !

tested, it works fine :-) !
really thanks everybody !

i'm waitng for hungarian names from harald now ! :))





  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default global or local intializing ??

Harald,
We never go offline or eat here in the US (or at the most, eat at the
desk) - guess we are "driven" <LOL

Best wishes to you as well Harald.

--
Tom Ogilvy


"Harald Staff" wrote in message
...
Thanks Tom. A few hours offline & dining here in Norway.

Best wishes Harald

"Tom Ogilvy" skrev i melding
...
http://support.microsoft.com/default...b;en-us;110264
INFO: Microsoft Consulting Services Naming Conventions for Visual

Basic



http://support.microsoft.com/default...b;en-us;173738
INFO: Object Hungarian Notation Naming Conventions for VB


--
Regards,
Tom Ogilvy



"furbiuzzu" wrote in message
oups.com...
YESS !

tested, it works fine :-) !
really thanks everybody !

i'm waitng for hungarian names from harald now ! :))







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I change a Name scope from local to Global? Henry Excel Discussion (Misc queries) 7 April 9th 10 10:36 PM
How can I change a Name scope from local to Global? Henry Excel Discussion (Misc queries) 0 September 23rd 08 07:24 PM
Global name used in local version clara Excel Discussion (Misc queries) 3 June 16th 08 06:54 PM
User Defined Functions - local or global? Simon Excel Worksheet Functions 5 September 27th 06 09:15 AM
Global vs Local variables Ken Loomis Excel Programming 1 October 12th 04 05:03 AM


All times are GMT +1. The time now is 05:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"