Thread: excel colors
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default excel colors

Go to the Thisworkbook module (in the vbe, go to the project explorer and
double click on ThisWorkbook for the Thisworkbook entry under your workbook's
tree).

In the left dropdown at the top select Workbook. From the right, select
OPEN.

Private Sub Workbook_Open()

End Sub

this will run whenever the workbook is opened and the user doesn't choose to
disable macros or have their security set to HIGH (xl2002 and later)

Put your code here

Private Sub Workbook_Open()

ThisWorkbook.Colors(1) = RGB(100, 200, 200)
ThisWorkbook.Colors(2) = RGB(100, 200, 200)
ThisWorkbook.Colors(55) = RGB(100, 200, 200)
ThisWorkbook.Colors(56) = RGB(100, 200, 200)

End Sub

that said, it shouldn't be an issue as the palette settings are stored in
the workbook. (if you change them and then save the workbook)

--
Regards,
Tom Ogilvy


"samearle" wrote:

How do I add the below???

I opened a new excel doc, went to tools - visuall basic editor. Then
added the following to module1:

ThisWorkbook.Colors(1) = RGB(100, 200, 200)
ThisWorkbook.Colors(2) = RGB(100, 200, 200)
ThisWorkbook.Colors(55) = RGB(100, 200, 200)
ThisWorkbook.Colors(56) = RGB(100, 200, 200)

basically, what I am trying to do is change collors to custom collors
every time the document opens. TO eliminate the document reverting to
standard colors or custom set on that machine.

Thanks,

Sam