Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
unable to get the Interior property of the range class
I get a variety of messages telling me VBA is "Unable to get [set] the
xxx property of the Range class". xxx may be Interior.Pattern or Numberformat, for example. Password protection is managed by code in this application, but at the points the problem arises, I have executed code in the immediate window to unprotect the workbook and all sheets. Plus, this works fine on 3 other machines. All four machines on which this is run have the same configuration: Excel 2003 (11.6355.6408) SP1 and XP Pro 5.1.2600 SP 2 build 2600. We also have the Framework CLR. The appliction was developed on one of the other 3 machines. This is very frustrating! Any clues would be much appreciated! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
unable to get the Interior property of the range class
Only a clue/speculation but worth checking. It is obviously
machine-dependent, and it works fine on all the others with the same Office and Win install. So, under normal circumstances we should expect the machine would behave like the others but it isn't. There must be something different in its setup, but not in the "obvious" things. If it is not recognizing an object's properties, one cause is that it thinks it is looking at a different object (Class). Check the References that are checked off in the VBA editor Tools... References. Maybe it is using an older Excel object library, even though the new one is installed. Or, (doubtful) maybe it is using some other object model that has a "Range" object in it. If there are object name conflicts, VBA would use the highest priority (i.e. the one checked first in the list of references). -- - K Dales "joe" wrote: I get a variety of messages telling me VBA is "Unable to get [set] the xxx property of the Range class". xxx may be Interior.Pattern or Numberformat, for example. Password protection is managed by code in this application, but at the points the problem arises, I have executed code in the immediate window to unprotect the workbook and all sheets. Plus, this works fine on 3 other machines. All four machines on which this is run have the same configuration: Excel 2003 (11.6355.6408) SP1 and XP Pro 5.1.2600 SP 2 build 2600. We also have the Framework CLR. The appliction was developed on one of the other 3 machines. This is very frustrating! Any clues would be much appreciated! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
unable to get the Interior property of the range class
An "Unable to set the property of the range class" message might not
indicate a problem with setting the property but rather an inability (due to lack of information) to find the specified Range under the current conditions. Is your Range fully qualified? i.e., are you specifying a workbook & worksheet: ThisWorkbook.Sheet("Sheet1").Range("myRange").Inte rior.Pattern rather than the "shortcut" version: Range("MyRange").Interior.Pattern? The "sometimes works, sometimes doesn't" element of your post makes me ask because the 2nd sample can fail with the error you describe if certain assumptions are incorrect: i.e., the active workbook or active sheet (which are what VB will assume unless you tell it otherwise) are different than expected and therefore vb can't resolve MyRange (or if there is no active sheet...). HTH, -- George Nicholson Remove 'Junk' from return address. "K Dales" wrote in message ... Only a clue/speculation but worth checking. It is obviously machine-dependent, and it works fine on all the others with the same Office and Win install. So, under normal circumstances we should expect the machine would behave like the others but it isn't. There must be something different in its setup, but not in the "obvious" things. If it is not recognizing an object's properties, one cause is that it thinks it is looking at a different object (Class). Check the References that are checked off in the VBA editor Tools... References. Maybe it is using an older Excel object library, even though the new one is installed. Or, (doubtful) maybe it is using some other object model that has a "Range" object in it. If there are object name conflicts, VBA would use the highest priority (i.e. the one checked first in the list of references). -- - K Dales "joe" wrote: I get a variety of messages telling me VBA is "Unable to get [set] the xxx property of the Range class". xxx may be Interior.Pattern or Numberformat, for example. Password protection is managed by code in this application, but at the points the problem arises, I have executed code in the immediate window to unprotect the workbook and all sheets. Plus, this works fine on 3 other machines. All four machines on which this is run have the same configuration: Excel 2003 (11.6355.6408) SP1 and XP Pro 5.1.2600 SP 2 build 2600. We also have the Framework CLR. The appliction was developed on one of the other 3 machines. This is very frustrating! Any clues would be much appreciated! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
unable to get the Interior property of the range class
I took the advice of one reply, and compared the project's references on
my machine to those on the other three machines. Voila! I have 5 refs, they each have 4. BUT my "extra reference" library is Microsoft Forms 2.0 Object Library, which seems to contain controls - buttons, text boxes and so on. addinga single form to a new project in a new workbook automatically adds this library. How can the others not have it? Very odd... *** Sent via Developersdex http://www.developersdex.com *** |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
unable to get the Interior property of the range class
In repsonse to George's comments, I added some debug code. Once an OK
button is clicked in the application, the problematic line actually gets executed several times (4, acutually) before causing an RT error on the 5th time. I can see nothing in the code that would change state from one time to the next. What could it be other than the environment? And what in the environment other than protection? (static_int is a local static variable. I expected it to increment, so now I have another mystery.) Set wksht = Worksheets("DataInput") Set theCell = wksht.Cells(cur_row, ValCol) If cur_row = 11 And ValCol = 11 Then static_int = static_int + 1 Debug.Print "Static_int = " & static_int & ", sheet = " & wksht.name End If If theCell.Interior.Pattern = xlGray16 Then... Debug Output: Static_int = 1, sheet = DataInput Static_int = 1, sheet = DataInput Static_int = 1, sheet = DataInput Static_int = 1, sheet = DataInput Static_int = 1, sheet = DataInput <runtime error "Unable to get the interior property of the Range class" *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unable to get the Interior property of the PlotArea class | Charts and Charting in Excel | |||
Unable to set FormulaArray property of the Range class | Excel Programming | |||
unable to set the FormulaArray property of the Range class | Excel Programming | |||
Unable to set the Locked property of the range class | Excel Programming | |||
Unable to set the colorIndex Property of the Interior Class Error | Excel Programming |