Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option Explicit is ignored
Anyone can shine a light on this please?
- I start my module with Option Explicit - In options I also have Require Variable Declaration checked In my code I use a variable that I did not declare in the Dim section. Yet, I can still run my code......... without the compliler triggering me that I forgot to declare the variable. I do not want this, what should I do to make the option explicit enforced? Thanks! M. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200910/1 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option Explicit is ignored
Probably you have that variable declared globally (Public) or at module
level (Private). Do a search in your project. RBS "Michiel via OfficeKB.com" <u40062@uwe wrote in message news:9e61b99e2ab81@uwe... Anyone can shine a light on this please? - I start my module with Option Explicit - In options I also have Require Variable Declaration checked In my code I use a variable that I did not declare in the Dim section. Yet, I can still run my code......... without the compliler triggering me that I forgot to declare the variable. I do not want this, what should I do to make the option explicit enforced? Thanks! M. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200910/1 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option Explicit is ignored
i've seen this occasionally. code will run fine, then all of a sudden i get the
error that a variable is not defined. never found out what causes it, as it doesn't happen very often. -- Gary Keramidas Excel 2003 "Michiel via OfficeKB.com" <u40062@uwe wrote in message news:9e61b99e2ab81@uwe... Anyone can shine a light on this please? - I start my module with Option Explicit - In options I also have Require Variable Declaration checked In my code I use a variable that I did not declare in the Dim section. Yet, I can still run my code......... without the compliler triggering me that I forgot to declare the variable. I do not want this, what should I do to make the option explicit enforced? Thanks! M. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200910/1 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option Explicit is ignored
I simplified the code since it was a lot of code.
But in this example it still occurs. I searched for the variable in other modules but it is not found anywhere M. ------------------- Option Explicit 'Constants to define where the columns of interest are in the input file eSec_Blackrock_SSB 9_10 Breakdown.xls Const cBAssetCat = 1 Const cBAccount = 2 Const cBCusip = 8 'Constants to define where the columns of interest are in the input file Security Valuation.xls Const cVRepAccNo = 1 Const cVMellonSec = 7 Const cVShpPar = 16 Const cVLocalPric = 24 Const cVLocMV = 26 'Constants to define where the columns of interest go in the output report Const cRRepAccNo = 1 Const cRAssetCat = 2 Const cRMellonSec = 3 Const cRShpPar = 4 Const cRLocalMV = 5 Const cRPArxLocMV = 6 Sub MakeReport() lngLastSectionRow = ActiveCell.row Msgbox lngLastSectionRow End Sub ------------------- Don Guillett wrote: As ALWAYS, post your code Anyone can shine a light on this please? [quoted text clipped - 11 lines] M. -- Message posted via http://www.officekb.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option Explicit is ignored
I searched (in the whole project) but it is not found.
I have added the extremely simplified code above. M. RB Smissaert wrote: Probably you have that variable declared globally (Public) or at module level (Private). Do a search in your project. RBS Anyone can shine a light on this please? [quoted text clipped - 11 lines] M. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200910/1 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option Explicit is ignored
Michiel - I copied and pasted your code (XL 2007) and got an error
message (Variable not defined) at: lngLastSectionRow = ActiveCell.row Which version are you using? I have had some redim statements allowed without a dim in earlier versions, which 2007 picked up. Doug |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option Explicit is ignored
I've seen the same thing. Sometimes it works, sometimes it doesn't. Most
of the time it works. "Gary Keramidas" wrote: i've seen this occasionally. code will run fine, then all of a sudden i get the error that a variable is not defined. never found out what causes it, as it doesn't happen very often. -- Gary Keramidas Excel 2003 "Michiel via OfficeKB.com" <u40062@uwe wrote in message news:9e61b99e2ab81@uwe... Anyone can shine a light on this please? - I start my module with Option Explicit - In options I also have Require Variable Declaration checked In my code I use a variable that I did not declare in the Dim section. Yet, I can still run my code......... without the compliler triggering me that I forgot to declare the variable. I do not want this, what should I do to make the option explicit enforced? Thanks! M. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200910/1 . |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option Explicit is ignored
I use version 2003 11.8302 SP3
Dougaj4 wrote: Which version are you using? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200911/1 |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Option Explicit is ignored
To all who were so kind to respond to my entry.
THANKS! I think it is indeed the same what Gary and Barb experienced. When I open a new workbook and drag over my VBA modules into that project and run the code I do get the error. This seems like some bug to me. So, THE SOLUTION / WORKAROUND: - Move the modules to a new workbook - Pray it will not happen again. ML. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200911/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Option Explicit | Excel Discussion (Misc queries) | |||
option explicit | Excel Discussion (Misc queries) | |||
Option Explicit | Excel Programming | |||
Option Commands (Option Explicit / Option Base etc) - Scope | Excel Programming | |||
Option Explicit | Excel Programming |