ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Declaring variables - Option Explicit (https://www.excelbanter.com/excel-programming/305807-declaring-variables-option-explicit.html)

Bijl167[_14_]

Declaring variables - Option Explicit
 
Hi,

I have a problem which I hope someone can explain to me. An excel fil
with a lot of macro's in it uses no "clean" declaration of variables
so not Dim i As Integer i=1, but just i=1), so every parameter i
declared as Variable. On my computer this file works with out
problem, on other computers the file gives an error message "canno
find Library".

I know this has someting to do with option explicit, but my question i
how can I let the file work on the other computers without declaring al
the variables for the macro's (which will take me a couple of days)

Thanks in advance

maarte

--
Message posted from http://www.ExcelForum.com


Amedee Van Gasse[_3_]

Declaring variables - Option Explicit
 
Bijl167 wrote:

Hi,

I have a problem which I hope someone can explain to me. An excel file
with a lot of macro's in it uses no "clean" declaration of variables (
so not Dim i As Integer i=1, but just i=1), so every parameter is
declared as Variable. On my computer this file works with out a
problem, on other computers the file gives an error message "cannot
find Library".

I know this has someting to do with option explicit, but my question
is how can I let the file work on the other computers without
declaring all the variables for the macro's (which will take me a
couple of days)

Thanks in advance

maarten


---
Message posted from http://www.ExcelForum.com/


Maarten,

So what you want is not to fix your bad coding style, but how to make
it even worse? The first rule of Excel/VBA debugging should always be:
declare correctly!
See here why and how:
http://www.cpearson.com/excel/DeclaringVariables.htm
http://www.cpearson.com/excel/variables.htm

As soon as you have declared everything, try again. If it still does
not work, come back here and we'll try to help you.

--
Amedee Van Gasse using XanaNews 1.16.3.1
If it has an "X" in the name, it must be Linux?
Please don't thank me in advance. Thank me afterwards if it works or
hit me in the face if it doesn't. ;-)

PS: I found 2 small shortcomings on www.excelforum.com:
1. You do *not* have to pay for access to news:msnews.microsoft.com
2. A *real* newsreader (not Outlook Express) is actually very easy to
use. See www.newsreaders.com for more info.

Bob Phillips[_6_]

Declaring variables - Option Explicit
 
Maarten,

Check whether the other computer has missing links. In VBE, got to
ToolsReferences, and if any say Missing, uncheck them.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bijl167 " wrote in message
...
Hi,

I have a problem which I hope someone can explain to me. An excel file
with a lot of macro's in it uses no "clean" declaration of variables (
so not Dim i As Integer i=1, but just i=1), so every parameter is
declared as Variable. On my computer this file works with out a
problem, on other computers the file gives an error message "cannot
find Library".

I know this has someting to do with option explicit, but my question is
how can I let the file work on the other computers without declaring all
the variables for the macro's (which will take me a couple of days)

Thanks in advance

maarten


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 06:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com