Sub Employeev2()
'
Dim shpHolder As Shape
Dim objMain As SmartArt
Dim objNode As SmartArtNode
Dim cRow As Long
Dim cCol As Long
Application.ScreenUpdating = False
'Set Layout
Set oSALayout = Application.SmartArtLayouts(83) '83>> Basic Radial
For cRow = 2 To 8
Set shpHolder = ActiveSheet.Shapes.AddSmartArt(oSALayout)
Set objMain = shpHolder.SmartArt
'clear default nodes, leaving base only
Do While objMain.AllNodes.Count > 1
objMain.AllNodes(objMain.AllNodes.Count).Delete
Loop
Set objNode = objMain.AllNodes(1)
objNode.TextFrame2.TextRange.Text = Cells(cRow, 1).Text 'employee
cCol = 2
Counter = 1
For cCol = 2 To 6
If UCase(Cells(cRow, cCol)) = "YES" Then
Set objNode = objMain.AllNodes.Add
objNode.TextFrame2.TextRange.Text = Cells(1, cCol).Text
Counter = Counter + 1
End If
Next
cCol = 2
Next
'next section is to clean up the SmartArts and position
'at this point you can add labels if you want
Dim numCol As Integer
Dim w As Long
Dim h As Long
Dim TopPosition As Long
Dim leftposition As Long
numcols = 2 'number of columns for Shapes
w = 300 'width of Shape
h = 200 'Height of Shape
'Change starting positions, if necessary
TopPosition = 30
leftposition = 350
For i = 1 To ActiveSheet.Shapes.Count
With ActiveSheet.Shapes(i)
.Width = w
.Height = h
.Left = leftposition + ((i - 1) Mod numcols) * w
.Top = TopPosition + Int((i - 1) / numcols) * h
.SmartArt.Color = Application.SmartArtColors(4) 'apply color theme
.SmartArt.QuickStyle = Application.SmartArtQuickStyles(10) 'apply quick Style
End With
Next i
Application.ScreenUpdating = True
End Sub
code to do SmartArt with basic radial instead
also i found out how to do the color theme and quick style properly
use this below code to figure out what is what, comment out each
'https://www.experts-exchange.com/questions/28350113/smartArtLayouts-enumeration.html
'get the smartartlayout, color or style enumeration list into immediate window (Ctrl+G)
Sub getSA()
Dim i As Integer
On Error Resume Next
Do
i = i + 1
'Debug.Print i & ">> " & Application.SmartArtLayouts(i).Name
'Debug.Print i & ">> " & Application.SmartArtColors(i).Name
Debug.Print i & ">> " & Application.SmartArtQuickStyles(i).Name
Loop Until Err <> 0
End Sub
Bookmarks