View Single Post
 
Old 06-19-2016, 09:13 PM
wlcdo2 wlcdo2 is offline Windows 7 32bit Office 2013
Novice
 
Join Date: Jun 2016
Posts: 17
wlcdo2 is on a distinguished road
Default Update Cell in a Table with Value from User Form

I have a table within Word 2013 document. I want the user to select any cell within that table to be the 'recipient' of a value from a User Form. The user then opens the User Form that displays various choices by way of OptionButtons i.e. they may select from values such as A0, A3, A5, C5. Once they have made their choice, I have an "Update" button that transfers the value of the OptionButton to the cell in the table. I tried by inserting a Bookmark into the table, like so:

Code:
Private Sub btnUpdateP_Click()

Dim PeopleChoice As String, Tbl As Table, Rng As Range

If Me.optA0 Then
    PeopleChoice = "A0"
ElseIf Me.optA3 Then
    PeopleChoice = "A3"
ElseIf Me.optA5 Then
    PeopleChoice = "A5"
Else
    PeopleChoice = "C5"
End If
    Selection.Bookmarks.Add ("bmPeople")
    ActiveDocument.Bookmarks("bmPeople").Select
    Selection.Text = PeopleChoice
When I run through the code using the debugger, it works fine, but when I run the code for real (using an ActiveX button), the Bookmark is inserted at the location of the button that calls the UserForm, instead of the Table Cell.

Can anyone assist me with this one please?

Thank you.

Corin.
Reply With Quote