title: How to output shape ID in Visio-VBA
body: <p>Here is the code in text form in case the image is not loading:</p>
  
  <pre><code>Sub CommandButton1_Click()
     Dim NoIO As String
     Dim shp1 As Visio.Shape
     NoIO = ComboBox1.Value
  
     If NoIO = "7" Then
        MsgBox shp1.ID
        'Call test(shp1)'
        'Target shape id selected'
        'Change shape data of that shape'
     End If
     Unload Me
  End Sub    
  </code></pre>
  
  <p>Whenever I try to output the ID of a shape, I get the error: </p>
  
  <blockquote>
    <p>Object variable or With block variable not set</p>
  </blockquote>
  
  <p>I cannot change the parameters of the subroutine as I get a procedure declaration mismatch since this code runs after a button click on a user form.</p>