Hi everyone,
I have created a Word 2007 form containing some text fields which works fine, except that sometimes the focus is not right.
For the text fields I used a ContentControl.
I also have a commandbutton which gets a range from the ContentControl, using a bookmark, eg:
Code:ActiveDocument.Bookmarks("bk1").Range.ContentControls(1).Range which then calculates the word count, and updates the text in a second ContentControl:This gets odd when I double click elsewhere in the protected form, and then press the button. Everything updates, but I can't edit the text in the first ContentControl anymore. Even though my cursor was in the ContentControl text, and clicking moved it, typing didn't do anything.Code:wordCount = RngToCount.ComputeStatistics(wdStatisticWords) CtrlToUpdate.Range.Text = wordCount
Eventually some combination of clicking in other controls and pressing the update button would get focus to work again, but I don't know why I'm losing it in the first place.
I tried this after updating the second ContentControl:
The selection happened as expected, but the focus problem is still there if I had first double clicked some text outside theCode:If Not (Selection.InRange(RngToCount)) Then RngToCount.Select Selection.HomeKey Unit:=wdLine End If
control.
What am I missing?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks