Hi Kurt,
Essentially what you need to do is to use a Shape variable that you can refer to throughout your code. Then create the shape based upon the information contained in the userform.
There are two ways of getting the userform information. The first is to use Public variables (declared in a general module) and populate these with the userform data before it is unloaded. The second is to Hide the userform rather than Unload it. The latter would be my preferred method and this is what I have used in the attached example.
Rather than creating multiple shapes, that may be difficult to keep track of, the code uses just one shape that is deleted and then recreated on each execution of the code.
I don't have the time (nor, if I'm honest, the inclination ) to provide a fully-working example with all of the features that you have on the userform, I have only covered the type of shape and the height and width. However, I believe that with the information that I have provided you should be able to complete the task for yourself.
Please note that I have not included any error-checking for cases where no entries are made - I will leave it to you to do this and implement whatever default values you want to use.
For those who are unwilling (or unable) to download files from the internet the code is as follows.
In the userform:
Private Sub CB_Review_Click()
Me.Hide
End Sub
Private Sub UserForm_Initialize()
With LB_Shapes
.AddItem "Oval"
.AddItem "Rectangle"
.AddItem "Triangle"
.AddItem "Pentagon"
.AddItem "Trapezoid"
End With
End Sub
In a general module:
Const strShName As String = "GolfLogo"
Sub DisplayShape()
Dim shLogo As Shape, lType As Long
Dim lWidth As Long, lHeight As Long
'variables to work with
Const lLeft As Long = 100
Const lTop As Long = 150
'some constants
UF_GolfLogo.Show
'show the userform
DeleteShape
'delete any existing logo
Select Case UF_GolfLogo.LB_Shapes.Value
Case Is = "Oval": lType = 9 'msoShapeOval
Case Is = "Rectangle": lType = 1 'msoShapeRectangle
Case Is = "Triangle": lType = 7 'msoShapeIsoscelesTriangle
Case Is = "Pentagon": lType = 51 'msoShapePentagon
Case Is = "Trapezoid": lType = 3 'msoShapeTrapezoid
Case Else: lType = 1 'default if nothing selected
End Select
'determine type of shape to add
Set shLogo = Sheet1.Shapes.AddShape(lType, lLeft, lTop, 1, 1)
'add shape to work with (expression.AddShape(Type, Left, Top, Width, Height))
With UF_GolfLogo
lWidth = .TB_Length
lHeight = .TB_Height
End With
'get values from userform
With shLogo
.Name = strShName
.Width = lWidth
.Height = lHeight
End With
'apply values to shape
End Sub
Sub DeleteShape()
On Error Resume Next
Sheet1.Shapes(strShName).Delete
On Error GoTo 0
End Sub
And in the ThisWorkbook object:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
DeleteShape
'clear old shapes to avoid showing details of last customer to current customer
Me.Save
End Sub
Workbook attachment: