Use VBA to place signatures in a word document by selecting radio buttons RRS feed

  • Question

  • Hi,

    I'm creating an word document with signatures. I have 4 signatures of which max 2 and at least 1 can be choosen.

    I created 2 frames with 4 radiobuttons. The document writer can select one button in the frst frame with the names of het directors and none or 1 in the other frame. How can I relate the choosen radiobuttons to pictures of the signatures and place them in a table in the word document?

    Thursday, January 15, 2015 11:37 AM

All replies

  • I don't understand what you are saying.  I do this from a form.  The user selects a signatory from a combobox.  I look up the corresponding png file in a database and insert a picture, signatory name/position in doc at specified bookmarks in the template.  This is the code to insert picture at bookmark.

    Sub SetBkMarkPic(xDoc As Document, xBkName As String, xFile As String)
    ' Set bookmark in document.  Add file to bookmark
      If xDoc.Bookmarks.Exists(xBkName) Then
        xDoc.Bookmarks(xBkName).Range.Text = ""
        Selection.InlineShapes.AddPicture fileName:=xFile
      End If
    End Sub

    • Edited by mogulman52 Friday, January 16, 2015 6:34 PM
    Friday, January 16, 2015 6:32 PM
  • Thanks,

    I don't understand the workings of bookmarks or what you just typed.

    I think I better stay away from VBA en word...


    • Edited by Lodendijk Thursday, February 12, 2015 11:44 AM
    Thursday, February 12, 2015 11:21 AM
  • An easy method to put text or pictures with VBA is to put a bookmark in the document.  It it essentially marks a place in the document so you don't have to do any clumsy searching for the right spot.  I use them extensively when automating any document creating process.  I use the to insert dates, addresses, names, etc...  It does take patience to learn VBA for Word but the benefits can be large if you do a lot of document creation.  A book like 'Mastering VBA for Office 2010' can really help.
    Thursday, February 12, 2015 3:35 PM