Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In message of Sun,
11 Apr 2010 19:40:01 in microsoft.public.excel.programming, Perry writes Sorry guys, I found the problem, the code shoukd work after correcting one error. Set actWin = Active.Window shoud be Set actWin = ActiveWindow My suspicion was that option explicit would have identified your problem. I tried the following in Excel 2003. 1) I copied and pasted your example. 2) Several lines had wrapped into invalid code. I unwrapped to fix. 3) The next line found your error: Option Explicit ' Force explicit variable declaration. 4) It found 2 more which I "fixed" with the following at module level: Const appVer = 12 Dim ptr As Integer I find Option Explicit regularly protects me from idiocy. I suggest the OP should use it in all his code. However it does not protect me from hiding a variable with code like Dim foo as Range Sub bar() Dim foo as Variant .... foo.value = "fubar" End Sub Such code is a disaster waiting to happen if the second Dim statement is deleted. I know of no automatic method of detecting such problems. It is something I would like to see in a VBA Lint, if somebody would write such code. cf. <http://en.wikipedia.org/wiki/Lint_%28software%29 -- Walter Briscoe |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
protect sheet in 2003 vs 2007 | Excel Programming | |||
Excel 2007 Macro Help (Excel 2003 not working in 2007) | Excel Discussion (Misc queries) | |||
Protect sheet Excel 2007 | Excel Programming | |||
Excel 2003 protect not working in Excel 97 | Excel Programming | |||
VB to protect cells not working in Excel 2003? | Excel Programming |