Hi all,
ik probeer een pivotstyle te maken via VBA. Nu lukt dat aardig, alleen niet alle gewenste aanpassingen worden door mijn code doorgevoerd.
Volgens mij geef ik in onderstaande code dat alle header en filter text in het wit en bold moet worden weergegeven. Dit wordt echter niet toegepast door de code.
Weet iemand waar het aan ligt?
ik probeer een pivotstyle te maken via VBA. Nu lukt dat aardig, alleen niet alle gewenste aanpassingen worden door mijn code doorgevoerd.
Volgens mij geef ik in onderstaande code dat alle header en filter text in het wit en bold moet worden weergegeven. Dit wordt echter niet toegepast door de code.
Weet iemand waar het aan ligt?
Code:
Sub Create_Table_Style()
ActiveWorkbook.TableStyles.Add ("MyOwnPivotTableStyle")
With ActiveWorkbook.TableStyles("MyOwnPivotTableStyle")
.ShowAsAvailablePivotTableStyle = True
.ShowAsAvailableTableStyle = False
.ShowAsAvailableSlicerStyle = False
.ShowAsAvailableTimelineStyle = False
End With
With ActiveWorkbook.TableStyles("MyOwnPivotTableStyle").TableStyleElements(xlWholeTable)
With .Borders(xlEdgeTop)
.Color = 2952910
.TintAndShade = 0
.Weight = xlThin
.LineStyle = xlNone
End With
With .Borders(xlEdgeBottom)
.Color = 2952910
.TintAndShade = 0
.Weight = xlThin
.LineStyle = xlNone
End With
With .Borders(xlEdgeLeft)
.Color = 2952910
.TintAndShade = 0
.Weight = xlThin
.LineStyle = xlNone
End With
With .Borders(xlEdgeRight)
.Color = 2952910
.TintAndShade = 0
.Weight = xlThin
.LineStyle = xlNone
End With
With .Borders(xlInsideHorizontal)
.Color = 2952910
.TintAndShade = 0
.Weight = xlThin
.LineStyle = xlNone
End With
End With
With ActiveWorkbook.TableStyles("MyOwnPivotTableStyle").TableStyleElements(xlHeaderRow)
With .Font
.FontStyle = "Bold"
.TintAndShade = 0
.ColorIndex = 2
End With
With .Interior
.Color = 2952912
.TintAndShade = 0
End With
End With
With ActiveWorkbook.TableStyles("MyOwnPivotTableStyle").TableStyleElements(xlPageFieldLabels)
With .Font
.FontStyle = "Bold"
.TintAndShade = 0
.ColorIndex = 2
End With
With .Interior
.Color = 2952910
.TintAndShade = 0
End With
End With
With ActiveWorkbook.TableStyles("MyOwnPivotTableStyle").TableStyleElements(xlPageFieldValues)
With .Font
.FontStyle = "Bold"
.TintAndShade = 0
.ColorIndex = 2
End With
With .Interior
.Color = 2952910
.TintAndShade = 0
End With
End With
ActiveWorkbook.TableStyles("MyOwnPivotTableStyle").TableStyleElements(xlTotalRow).Font.FontStyle = "Bold"
ActiveWorkbook.DefaultPivotTableStyle = "MyOwnPivotTableStyle"
End Sub
Bijlagen
Laatst bewerkt: