title: Determine which button was pressed?
body: <p>I'm wondering if there's a simple way for a Word macro to determine which button was just pressed? I have a document template with several button which should all fire a macro. 
  The thing is, I want to create ONE macro which is called in each button. I don't want tons of macros for each button. </p>
  
  <p>Now, this macro, when the button is pressed, it inserts a picture and the size of this picture is selected based on the buttons size. Meaning, this ends up as a picture placeholder. But, I want to write the macro dynamically so that the same code will work on each button without doing more than just calling the macro.</p>
  
  <p>The complete macro is already done, I just need to know this one last thing, if anyone has any info on how to accomplish this? :) Thanx in advance!</p>
  
  <p>UPDATE: This is the code at the moment</p>
  
  <p>Private Sub ImageButton1_Click()
  PicturePlaceholder ImageButton1
  End Sub</p>
  
  <p>Private Sub ImageButton2_Click()
  PicturePlaceholder ImageButton2
  End Sub</p>
  
  <pre><code>Public Sub PicturePlaceholder(ByVal oButton As CommandButton)    
  Dim oShape As Word.Shape
  Dim Dlg As Office.FileDialog
  Dim strFilePath As String
  Dim oDoc As Document
  Dim rgePlace As Range
  Dim buttonHeight As String
  Dim buttonWidth As String
  
  Set Dlg = Application.FileDialog(msoFileDialogFilePicker)
  Set oDoc = ActiveDocument
  
  
  Set rgePlace = Selection.Range.Fields(1) _
  .Result.Paragraphs(1).Range
  
  Response = MsgBox("Do you want to delete the button/Picture?", vbYesNoCancel, "Do you want an image here?")
  If Response = vbYes Then rgePlace.Fields(1).Delete
  If Response = vbCancel Then Exit Sub
  If Response = vbNo Then
  
  With Dlg
  .AllowMultiSelect = False
  If .Show() &lt;&gt; 0 Then
  strFilePath = .SelectedItems(1)
  End If
  End With
  
  If strFilePath = "" Then Exit Sub
  Set oShape = oDoc.Shapes.AddPicture(FileName:=strFilePath, _
  LinkToFile:=False, SaveWithDocument:=True, _
  Anchor:=rgePlace)
  With oShape
  .Height = oButton.Height
  .Width = oButton.Width
  End With
  
  rgePlace.Fields(1).Delete
  
  
  End If
  End Sub
  </code></pre>