View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
George Nicholson[_2_] George Nicholson[_2_] is offline
external usenet poster
 
Posts: 170
Default 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!