I have the follow code that is running in an Excel and it's calling a PowerPoint slide. I am setting a text to each existing node of the SmartArt and it's working. However, I am getting error when I use AddNode method (oSmartArt.AllNodes.Add.AddNode
). What am I doing wrong?
Set oSmartArt = d_ppt_output.Slides(SLIDE_SMART).Shapes("MyList").SmartArt
x = 1
While Cells(x, 1).Text <> ""
If x > oSmartArt.Nodes.Count Then
oSmartArt.AllNodes.Add.AddNode ''''' ERROR IS HERE!
End If
oSmartArt.AllNodes(x).Shapes.TextFrame2.TextRange.Text = ActiveSheet.Cells(x, 2).Text
x = x + 1
Wend
I also replaced oSmartArt.AllNodes.Add.AddNode
by oSmartArt.Nodes.Add.AddNode
but I get the same problem.
The error is: -2147467259 (80004005) Method 'add' of object 'SmartArtNodes' failed
The whole code can by found here - https://drive.google.com/drive/folders/1_O79iiG7hbBjMHMSH6kZGkWmjN1WGorR?usp=sharing