EssVSetStyle

Description

Sets styles information.

Syntax

EssVSetStyle (sheetName, styleType, dimName, item, newValue)
ByVal sheetName As Variant
ByVal styleType As Variant
ByVal dimName As Variant
ByVal item As Long
ByVal newValue As Variant

Parameters

sheetName

sheetName is the text name of the worksheet to perform the action. sheetName is of the form "[Book.xls]Sheet". If sheetName is Null or Empty, the active worksheet is used.

styleType

styleType specifies the style setting you want to set.

Table 17. styleType Style Settings

styleTypeStyle Setting

0

Dimension

1

Parent Members

2

Child Members

3

Shared Members

4

Read Only

5

Read/Write

6

Contains Formula

7

Dynamic Calculations

8

Linked Objects

11

Attributes

12

Integration Server Drill-Through

dimName

dimName is the dimension name if styleType is 0; otherwise this parameter should be set to Null.

item

item is the style you want to set.

newValue

newValue contains the new setting of item.

Table 18. Item Style Settings

ItemMeaningnewValue

1

Use style

Boolean

2

Font name

Text

3

Font size

Number

4

Bold

Boolean

5

Italic

Boolean

6

Underline

Boolean

7

Strikeout

Boolean

8

Foreground color

Number

9

Background color

Number

10

Border

Boolean

Table 19 lists foreground and background colors.

Table 19. Foreground and Background Colors

IntegerColor

1

Black

2

White

3

Red

4

Lime

5

Blue

6

Yellow

7

Fuchsia

8

Aqua

9

Maroon

10

Green

11

Navy

12

Olive

13

Purple

14

Teal

15

Silver

16

Gray

Return Value

Returns 0 if successful. A negative number indicates a local failure (see VBA Return Values). A return value greater than zero indicates a failure on the server.

Example

Declare Function EssVSetStyle Lib "ESSEXCLN.XLL" (ByVal sheetName As Variant, ByVal styleType As Variant, ByVal dimName As Variant, ByVal item As Long, ByVal newValue As Variant) As Long

Sub SetStyle()
'This sets the parent member style to italic
X=EssVSetStyle("[Book2.xls]Sheet1",1,Empty,5,TRUE)
'This ensures the appropriate check box will be checked
'Note: If you want the Use Style check box to be checked,
'use the EssVSetSheetOption function
Y=EssVSetStyle("[Book2.xls]Sheet1",1,Empty,1,TRUE)
If X=0 And Y = 0 Then
   MsgBox("Set style successful.")
Else
   MsgBox("Set style failed.")
End If
End Sub

Notes