title: How to pass string user input (RGB) to VBA
body: <p>I have a userform with RGB values to be assigned to shapes that will be later created by the macro:</p>
  <pre><code>Private Sub UserForm_Initialize()
  
      With lstChosenColor
          lstChosenColor.AddItem &quot;RGB(0, 0, 0)&quot;
          lstChosenColor.AddItem &quot;100, 100, 100&quot; 'different from the above to show one alternative of my trials
      End With
  
  End Sub
  </code></pre>
  <p>However I do not know how to insert the selected value into the macro itself. I tried in many ways:</p>
  <pre><code>    Dim lstChosenColor As String 'somewhere else i saw it as Long, tried but without success
  '   Dim ChosenColor As String
  '   ChosenColor = lstChosenColor 'I tried this one, too
  
  
  
          If lstChosenColor = False Then
              MsgBox &quot;No Color Selected&quot;
          Else: New_Shape.Fill.ForeColor.RGB = lstChosenColor.Selected 'I tried also 'New_Shape.Fill.ForeColor.RGB = lstChosenColor and 'New_Shape.Fill.ForeColor.RGB = RGB(lstChosenColor)
          End If
  
  
  
              Set New_Shape = myDocument.Shapes.AddShape(Type:=msoShapeOval, Left:=Shp_Cntr - ((Shp.Width + 2) / 2), Top:=Shp_Mid - ((Shp.Width + 2) / 2), Width:=Shp.Width, Height:=Shp.Width)
  '            New_Shape.Fill.ForeColor.RGB = RGB(lstChosenColor) 'I commented this as it is part of a repeating block for a various number of shapes and I thought I could assign the RGB value above
  </code></pre>
  <p>Could anyone please advise?</p>