![]() |
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! |
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! |
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 |
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 |
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? |
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? |
global or local intializing ??
YESS !
tested, it works fine :-) ! really thanks everybody ! i'm waitng for hungarian names from harald now ! :)) |
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 ! :)) |
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 ! :)) |
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 ! :)) |
All times are GMT +1. The time now is 09:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com