Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default ColorIndex property XL2000 vs 2003

I have recently upgraded from Office 2000 to 2003 Pro. I have a spreadsheet
containing VBA code that halts when run in 2003 with the following
'unexpected error':

Unable to set the ColorIndex property of the Font class

Code execution then stops. Here is the offending code line

Range(cell_dest).Font.ColorIndex = 0

I have tried changing the value to no effect and cannot find anything about
this error anywhere in the KB or newsgroups. Using VBA 6.3 in both 2000 and
2003 setups.

Any ideas anyone - this spreadsheet is critical to my work!

Tks
Mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default ColorIndex property XL2000 vs 2003

Hi Mark

This runs fine in my 2003:

Sub Macro1()
Dim cell_dest As String
cell_dest = "A2"
Range(cell_dest).Font.ColorIndex = 0
End Sub

Is the sheet protected in any way ? Or is there a missing reference (in the
VB editor menu Tools References) ?

Best wishes Harald

"MarkT" skrev i melding
...
I have recently upgraded from Office 2000 to 2003 Pro. I have a

spreadsheet
containing VBA code that halts when run in 2003 with the following
'unexpected error':

Unable to set the ColorIndex property of the Font class

Code execution then stops. Here is the offending code line

Range(cell_dest).Font.ColorIndex = 0

I have tried changing the value to no effect and cannot find anything

about
this error anywhere in the KB or newsgroups. Using VBA 6.3 in both 2000

and
2003 setups.

Any ideas anyone - this spreadsheet is critical to my work!

Tks
Mark




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default ColorIndex property XL2000 vs 2003

Harald,

Oooohhhh maaaannnn!!!!! All that messing about with the code and it's all
down to the 'format cells' check box in the new protection in XL 03.
Simple...when yu damn well know!!

Tks a lot Harald - you've improved my weekend a lot .

"Harald Staff" wrote:

Hi Mark

This runs fine in my 2003:

Sub Macro1()
Dim cell_dest As String
cell_dest = "A2"
Range(cell_dest).Font.ColorIndex = 0
End Sub

Is the sheet protected in any way ? Or is there a missing reference (in the
VB editor menu Tools References) ?

Best wishes Harald

"MarkT" skrev i melding
...
I have recently upgraded from Office 2000 to 2003 Pro. I have a

spreadsheet
containing VBA code that halts when run in 2003 with the following
'unexpected error':

Unable to set the ColorIndex property of the Font class

Code execution then stops. Here is the offending code line

Range(cell_dest).Font.ColorIndex = 0

I have tried changing the value to no effect and cannot find anything

about
this error anywhere in the KB or newsgroups. Using VBA 6.3 in both 2000

and
2003 setups.

Any ideas anyone - this spreadsheet is critical to my work!

Tks
Mark





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default ColorIndex property XL2000 vs 2003

"MarkT" skrev i melding
...

Oooohhhh maaaannnn!!!!! All that messing about with the code and it's all
down to the 'format cells' check box in the new protection in XL 03.
Simple...when yu damn well know!!

Tks a lot Harald - you've improved my weekend a lot .


Glad to hear that Mark. Thanks for the feedback.

Best wishes Harald


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default ColorIndex property XL2000 vs 2003

Mark,

There is no colorindex of 0, so I guess 2003 has just tightened up.

Try

Range(cell_dest).Font.ColorIndex = xlColorindexAutomatic

if using the Interior property, use xlColorindexNone.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"MarkT" wrote in message
...
I have recently upgraded from Office 2000 to 2003 Pro. I have a

spreadsheet
containing VBA code that halts when run in 2003 with the following
'unexpected error':

Unable to set the ColorIndex property of the Font class

Code execution then stops. Here is the offending code line

Range(cell_dest).Font.ColorIndex = 0

I have tried changing the value to no effect and cannot find anything

about
this error anywhere in the KB or newsgroups. Using VBA 6.3 in both 2000

and
2003 setups.

Any ideas anyone - this spreadsheet is critical to my work!

Tks
Mark






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default ColorIndex property XL2000 vs 2003

Mark,
Like Harald, you code works OK for me (XL 2003). ColorIndex=0 is
valid!


"Bob Phillips" wrote:

Mark,

There is no colorindex of 0, so I guess 2003 has just tightened up.

Try

Range(cell_dest).Font.ColorIndex = xlColorindexAutomatic

if using the Interior property, use xlColorindexNone.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"MarkT" wrote in message
...
I have recently upgraded from Office 2000 to 2003 Pro. I have a

spreadsheet
containing VBA code that halts when run in 2003 with the following
'unexpected error':

Unable to set the ColorIndex property of the Font class

Code execution then stops. Here is the offending code line

Range(cell_dest).Font.ColorIndex = 0

I have tried changing the value to no effect and cannot find anything

about
this error anywhere in the KB or newsgroups. Using VBA 6.3 in both 2000

and
2003 setups.

Any ideas anyone - this spreadsheet is critical to my work!

Tks
Mark





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default ColorIndex property XL2000 vs 2003

Hi Bob

0 is "automatic", used by fonts, opposed to "none" for interior, which
is -4142. Recording those actions said the same in 2000 and 2003:

Sub Macro2()
Range("A2").Select
Selection.Interior.ColorIndex = xlNone
Selection.Font.ColorIndex = 0
End Sub

Best wishes Harald

"Bob Phillips" skrev i melding
...
Mark,

There is no colorindex of 0, so I guess 2003 has just tightened up.

Try

Range(cell_dest).Font.ColorIndex = xlColorindexAutomatic

if using the Interior property, use xlColorindexNone.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"MarkT" wrote in message
...
I have recently upgraded from Office 2000 to 2003 Pro. I have a

spreadsheet
containing VBA code that halts when run in 2003 with the following
'unexpected error':

Unable to set the ColorIndex property of the Font class

Code execution then stops. Here is the offending code line

Range(cell_dest).Font.ColorIndex = 0

I have tried changing the value to no effect and cannot find anything

about
this error anywhere in the KB or newsgroups. Using VBA 6.3 in both 2000

and
2003 setups.

Any ideas anyone - this spreadsheet is critical to my work!

Tks
Mark






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default ColorIndex property XL2000 vs 2003

Hi Harald

0 is "automatic", used by fonts


for fonts it is -4105
MsgBox ActiveCell.Font.ColorIndex

But you can use 0 to set it
ActiveCell.Font.ColorIndex = 0

Is working for me also in 2003
There must be a other problem in the code from the OP

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Harald Staff" wrote in message ...
Hi Bob

0 is "automatic", used by fonts, opposed to "none" for interior, which
is -4142. Recording those actions said the same in 2000 and 2003:

Sub Macro2()
Range("A2").Select
Selection.Interior.ColorIndex = xlNone
Selection.Font.ColorIndex = 0
End Sub

Best wishes Harald

"Bob Phillips" skrev i melding
...
Mark,

There is no colorindex of 0, so I guess 2003 has just tightened up.

Try

Range(cell_dest).Font.ColorIndex = xlColorindexAutomatic

if using the Interior property, use xlColorindexNone.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"MarkT" wrote in message
...
I have recently upgraded from Office 2000 to 2003 Pro. I have a

spreadsheet
containing VBA code that halts when run in 2003 with the following
'unexpected error':

Unable to set the ColorIndex property of the Font class

Code execution then stops. Here is the offending code line

Range(cell_dest).Font.ColorIndex = 0

I have tried changing the value to no effect and cannot find anything

about
this error anywhere in the KB or newsgroups. Using VBA 6.3 in both 2000

and
2003 setups.

Any ideas anyone - this spreadsheet is critical to my work!

Tks
Mark








  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default ColorIndex property XL2000 vs 2003

Hi Harald,

I have no idea on 2003 as I don't have it, but automatic is -4105 on XL200
in front of me.

Bob


"Harald Staff" wrote in message
...
Hi Bob

0 is "automatic", used by fonts, opposed to "none" for interior, which
is -4142. Recording those actions said the same in 2000 and 2003:

Sub Macro2()
Range("A2").Select
Selection.Interior.ColorIndex = xlNone
Selection.Font.ColorIndex = 0
End Sub

Best wishes Harald

"Bob Phillips" skrev i melding
...
Mark,

There is no colorindex of 0, so I guess 2003 has just tightened up.

Try

Range(cell_dest).Font.ColorIndex = xlColorindexAutomatic

if using the Interior property, use xlColorindexNone.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"MarkT" wrote in message
...
I have recently upgraded from Office 2000 to 2003 Pro. I have a

spreadsheet
containing VBA code that halts when run in 2003 with the following
'unexpected error':

Unable to set the ColorIndex property of the Font class

Code execution then stops. Here is the offending code line

Range(cell_dest).Font.ColorIndex = 0

I have tried changing the value to no effect and cannot find anything

about
this error anywhere in the KB or newsgroups. Using VBA 6.3 in both

2000
and
2003 setups.

Any ideas anyone - this spreadsheet is critical to my work!

Tks
Mark








  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default ColorIndex property XL2000 vs 2003

"Bob Phillips" skrev i melding
...

I have no idea on 2003 as I don't have it, but automatic is -4105


Also when you record a macro while setting font color to automatic ?

on XL200 in front of me.


You /really/ need an upgrade my friend <bg

Best wishes Harald




  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default ColorIndex property XL2000 vs 2003


"Harald Staff" wrote in message
...
"Bob Phillips" skrev i melding
...

I have no idea on 2003 as I don't have it, but automatic is -4105


Also when you record a macro while setting font color to automatic ?


Well I'll be bu*!*#ed. It was 0. At times MS even frustrates me!

on XL200 in front of me.


You /really/ need an upgrade my friend <bg


This is the pre-MS, wind-up version. Don't go in for this new-fangled stuff
<ebg


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataLabel.Font.ColorIndex vs DataLabel.Text (Private Sub does not work in excel 2003) God Itself Charts and Charting in Excel 4 April 22nd 09 03:40 PM
Excel 2003 template for income producing commercial property RobOnFidalgo Excel Discussion (Misc queries) 0 August 29th 07 10:32 PM
Runtime error 380: Could not set the List property. invalid property value of listbox jasgrand Excel Programming 0 October 6th 04 09:28 PM
unable to set the colorindex property of the font class steve Excel Programming 3 December 17th 03 02:41 PM
Unable to set the colorIndex Property of the Interior Class Error GriffyGriff Excel Programming 3 October 3rd 03 04:37 PM


All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"