Change Excel.WorkBook default colors

  • Thread starter Thread starter Pierre
  • Start date Start date
P

Pierre

Hi,
Tryin to use this method :
MyExcelObject.Application.ActiveWorkBook.set_Colors(int index, object RHS).

But really don't know what this RHS is ?

Any ideas ?
Thks for help
 
Pierre,

RHS is an acronym for "Right Hand Side". The method you are calling is
really what is called when you set a property, and you should be using that
notation. I ^believe^ you want to be doing this:

MyExcelObject.Application.ActiveWorkBook.Colors[index] = color;

Remember that color is an RGB integer value, not a structure like it is
in .NET.

Hope this helps.
 
Thks but... ther's no ActiveWorkBook.Colors...

Nicholas Paldino said:
Pierre,

RHS is an acronym for "Right Hand Side". The method you are calling is
really what is called when you set a property, and you should be using that
notation. I ^believe^ you want to be doing this:

MyExcelObject.Application.ActiveWorkBook.Colors[index] = color;

Remember that color is an RGB integer value, not a structure like it is
in .NET.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Pierre said:
Hi,
Tryin to use this method :
MyExcelObject.Application.ActiveWorkBook.set_Colors(int index, object
RHS).

But really don't know what this RHS is ?

Any ideas ?
Thks for help
 
Pierre,

There probably is, it's just that ActiveWorkbook returns a type of
object, which you have to cast to the workbook type.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Pierre said:
Thks but... ther's no ActiveWorkBook.Colors...

Nicholas Paldino said:
Pierre,

RHS is an acronym for "Right Hand Side". The method you are calling is
really what is called when you set a property, and you should be using that
notation. I ^believe^ you want to be doing this:

MyExcelObject.Application.ActiveWorkBook.Colors[index] = color;

Remember that color is an RGB integer value, not a structure like it is
in .NET.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Pierre said:
Hi,
Tryin to use this method :
MyExcelObject.Application.ActiveWorkBook.set_Colors(int index, object
RHS).

But really don't know what this RHS is ?

Any ideas ?
Thks for help
 
I tried but no
((Excel.Workbook)xlsapp.ActiveWorkbook) has not "Color"

Nicholas Paldino said:
Pierre,

There probably is, it's just that ActiveWorkbook returns a type of
object, which you have to cast to the workbook type.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Pierre said:
Thks but... ther's no ActiveWorkBook.Colors...

"Nicholas Paldino [.NET/C# MVP]" <[email protected]> a écrit
dans le message de news:[email protected]...
Pierre,

RHS is an acronym for "Right Hand Side". The method you are
calling
is
really what is called when you set a property, and you should be using that
notation. I ^believe^ you want to be doing this:

MyExcelObject.Application.ActiveWorkBook.Colors[index] = color;

Remember that color is an RGB integer value, not a structure like
it
is
in .NET.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi,
Tryin to use this method :
MyExcelObject.Application.ActiveWorkBook.set_Colors(int index, object
RHS).

But really don't know what this RHS is ?

Any ideas ?
Thks for help
 
Pierre,

I should have seen it, but a workbook is a collection of worksheets.
What are you trying to change the color of? I think you should be getting a
sheet in the workbook, and then work with that.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Pierre said:
I tried but no
((Excel.Workbook)xlsapp.ActiveWorkbook) has not "Color"

Nicholas Paldino said:
Pierre,

There probably is, it's just that ActiveWorkbook returns a type of
object, which you have to cast to the workbook type.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Pierre said:
Thks but... ther's no ActiveWorkBook.Colors...

"Nicholas Paldino [.NET/C# MVP]" <[email protected]> a écrit
dans le message de Pierre,

RHS is an acronym for "Right Hand Side". The method you are calling
is
really what is called when you set a property, and you should be using
that
notation. I ^believe^ you want to be doing this:

MyExcelObject.Application.ActiveWorkBook.Colors[index] = color;

Remember that color is an RGB integer value, not a structure like it
is
in .NET.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi,
Tryin to use this method :
MyExcelObject.Application.ActiveWorkBook.set_Colors(int index,
object
RHS).

But really don't know what this RHS is ?

Any ideas ?
Thks for help
 
So, Here is the point (I should have start with that ^^)
Got a C# App which is linked to a Sql Server database and allow the user to
export to Excel File and create Charts.
The user can select a color for each series that will build the chart.

My problem is that the C# app Color Set is different form the Excel One.
So, I just want to change the Default Excel Color Set to insert the C# Color
filled by the User....



Nicholas Paldino said:
Pierre,

I should have seen it, but a workbook is a collection of worksheets.
What are you trying to change the color of? I think you should be getting a
sheet in the workbook, and then work with that.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Pierre said:
I tried but no
((Excel.Workbook)xlsapp.ActiveWorkbook) has not "Color"

"Nicholas Paldino [.NET/C# MVP]" <[email protected]> a écrit
dans le message de news:[email protected]...
Pierre,

There probably is, it's just that ActiveWorkbook returns a type of
object, which you have to cast to the workbook type.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Thks but... ther's no ActiveWorkBook.Colors...

"Nicholas Paldino [.NET/C# MVP]" <[email protected]> a écrit
dans le message de Pierre,

RHS is an acronym for "Right Hand Side". The method you are calling
is
really what is called when you set a property, and you should be using
that
notation. I ^believe^ you want to be doing this:

MyExcelObject.Application.ActiveWorkBook.Colors[index] = color;

Remember that color is an RGB integer value, not a structure
like
it
is
in .NET.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi,
Tryin to use this method :
MyExcelObject.Application.ActiveWorkBook.set_Colors(int index,
object
RHS).

But really don't know what this RHS is ?

Any ideas ?
Thks for help
 
You say "a workbook is a collection of worksheets".
Not strictly true.
A workbook HAS a collection of worksheets.


Nicholas Paldino said:
Pierre,

I should have seen it, but a workbook is a collection of worksheets.
What are you trying to change the color of? I think you should be getting a
sheet in the workbook, and then work with that.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Pierre said:
I tried but no
((Excel.Workbook)xlsapp.ActiveWorkbook) has not "Color"

Nicholas Paldino said:
Pierre,

There probably is, it's just that ActiveWorkbook returns a type of
object, which you have to cast to the workbook type.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Thks but... ther's no ActiveWorkBook.Colors...

"Nicholas Paldino [.NET/C# MVP]" <[email protected]> a écrit
dans le message de Pierre,

RHS is an acronym for "Right Hand Side". The method you are calling
is
really what is called when you set a property, and you should be using
that
notation. I ^believe^ you want to be doing this:

MyExcelObject.Application.ActiveWorkBook.Colors[index] = color;

Remember that color is an RGB integer value, not a structure like it
is
in .NET.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi,
Tryin to use this method :
MyExcelObject.Application.ActiveWorkBook.set_Colors(int index,
object
RHS).

But really don't know what this RHS is ?

Any ideas ?
Thks for help
 
Back
Top