Leading the way in Microsoft Office Development
 Home|

Excel

|Word|PowerPoint|VBA|SharePoint|Consultancy|Newsletter|Contact 
 Excel > Pictures & Graphics > VBA Code > Scheme Colours< Previous | Next > 

 

The macro recorder will always record a mixture of both exact colours and colours from the Colour Scheme

 
 
1
2
Selection.ShapeRange.Line.ForeColor.SchemeColor = 19
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   
 

You do not have to use the SchemeColor property to define you ForeColor but can use the RGB instead

 
 
3
Selection.ShapeRange.Line.ForeColor.RGB = RGB(255, 255, 255)
   

 
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Dim objShape As Excel.Shape

   objShape.Line.ForeColor.RGB = Microsoft.VisualBasic.RGB(0, 0, 0)
   objShape.Line.BackColor.RGB = Microsoft.VisualBasic.RGB(255, 255, 255)
   objShape.Line.Visible = Office.MsoTriState.msoTrue
   objShape.Line.Weight = 0.75
   objShape.Line.DashStyle = Office.MsoLineDashStyle.msoLineSolid
   objShape.Line.Style = Office.MsoLineStyle.msoLineSingle
   objShape.Line.Transparency = 0.0#
   objShape.Line.Pattern = Office.MsoPatternType.msoPattern25Percent
   objShape.Line.BeginArrowheadLength = Office.MsoArrowheadLength.msoArrowheadLengthMedium
   objShape.Line.BeginArrowheadStyle = Office.MsoArrowheadStyle.msoArrowheadDiamond
   objShape.Line.BeginArrowheadWidth = Office.MsoArrowheadWidth.msoArrowheadWide
   objShape.Line.EndArrowheadLength = Office.MsoArrowheadLength.msoArrowheadLengthMixed
   objShape.Line.EndArrowheadStyle = Office.MsoArrowheadStyle.msoArrowheadDiamond
   objShape.Line.EndArrowheadWidth = Office.MsoArrowheadWidth.msoArrowheadWidthMedium

   objShape.Fill.BackColor.RGB = Microsoft.VisualBasic.RGB(255, 255, 255)
   objShape.Fill.ForeColor.RGB = Microsoft.VisualBasic.RGB(255, 255, 255)
   objShape.Fill.OneColorGradient(Office.MsoGradientStyle.msoGradientDiagonalDown, 2, 2)
   objShape.Fill.TwoColorGradient(Office.MsoGradientStyle.msoGradientDiagonalDown, 3)
   objShape.Fill.Transparency = 0
   objShape.Fill.Visible = Office.MsoTriState.msoTrue
   objShape.Fill.Patterned(Office.MsoPatternType.msoPattern10Percent)
   



 
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Sub BET_DisplayColourScheme()
Dim inumber As Integer

   For inumber = 1 To 80
      Range("A" & inumber + 1).Value = inumber

      ActiveSheet.Shapes.AddShape(msoShapeRectangle, 47.25, inumber * 12.75, 93.75, 12.75).Select
      Selection.ShapeRange.Fill.Visible = msoTrue
      Selection.ShapeRange.Fill.Solid
      Selection.ShapeRange.Fill.ForeColor.SchemeColor = inumber
      Selection.ShapeRange.Fill.Transparency = 0#
   Next inumber
    
End Sub
   

 

Colour Scheme Numbers

 
   


 

Colour Palette Index

 
   


 Copyright © 2011 Better Solutions Limited. All Rights Reserved.< Previous | Top | Next >