Hello, i have a nice tool where i can adopt most of a smart art chart by cell values and colors.
But for some unknown reason, i cannot Change font Color and style adopting the Code for "root nodes"
For example:
' Set root node properties
Set QNode = QNodes(1)
With QNode.TextFrame2.TextRange
.Text = Range("B2").Value
.Font.Fill.ForeColor.RGB = vbBlack 'alt vbBlack
.Font.Size = UE
.Font.Bold = True 'Style = "Fett / Bold"
and the child nodes:
'Set Children
With QChild.TextFrame2.TextRange
.Text = Range("B" & r).Value
.Font.Fill.ForeColor.RGB = Range("C" & r).Font.Color
.Font.Size = RE
.Font.Italic = Range("C" & r).Font.Italic
…
If i want to change
.Font.Fill.ForeColor.RGB = vbBlack in the root node to .Font.Fill.ForeColor.RGB = Range("C" & r).Font.Color
i get an error. And i don´t know why, it only says the rang method is wrong…
does someone know, if this happens, because it is impossible to change the color and behavior of a root node by code?
Thanks,
Stef
Change Font color in Smart Art Chart
-
- 4StarLounger
- Posts: 415
- Joined: 29 Mar 2010, 11:50
- Location: Vienna, Austria
Change Font color in Smart Art Chart
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78535
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Change Font color in Smart Art Chart
Could you attach a sample workbook? Thanks in advance.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 415
- Joined: 29 Mar 2010, 11:50
- Location: Vienna, Austria
Re: Change Font color in Smart Art Chart
here it is
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78535
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Change Font color in Smart Art Chart
Thanks!
At that point in the code, the variable r hasn't been assigned a value yet, so r = 0. Range("C0") doesn't exist, hence the error.
You can use
Remark: currently, the font color of C2 is set to white, so you'd get white text on a yellow background. That is hard to read!
At that point in the code, the variable r hasn't been assigned a value yet, so r = 0. Range("C0") doesn't exist, hence the error.
You can use
Code: Select all
' Set root node properties
Set QNode = QNodes(1)
With QNode.TextFrame2.TextRange
.Text = Range("B2").Value
.Font.Fill.ForeColor.RGB = Range("C2").Font.Color
.Font.Size = UE
.Font.Bold = True 'Style = "Fett / Bold"
End With
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 415
- Joined: 29 Mar 2010, 11:50
- Location: Vienna, Austria
Re: Change Font color in Smart Art Chart
Ok, ist definitely so with the start root node in c2, but with the other root nodes below, if i define it, it would be possible to use the variable r?
-
- Administrator
- Posts: 78535
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Change Font color in Smart Art Chart
Yes! See the attached version.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 415
- Joined: 29 Mar 2010, 11:50
- Location: Vienna, Austria
Re: Change Font color in Smart Art Chart
Perfect! i only had to take C & r, and after testing it, works like a charm. Thank You!