View Single Post
 
Old 04-27-2018, 04:07 AM
slaycock slaycock is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default

Quote:
Is it possible to do something like this
Yes it is very possible to do this and your sample code shows you are thinking along the right lines. The reason you can use this approach is that the 'metadata' you will use to set the status of the radiobuttons is captured in the hidden property of text in the bookmark range.

I would suggest that the user form initialisation event is the best place for your code.

Code:
Private Sub UserForm_Initialize()

    ' for each bookmark you need a line of code similar to

    Me.LJNejKnapp = ActiveDocument.Bookmarks("LJSidor1").Range.Font.Hidden

    ' which assumes that if hidden = true then you want Me.LJNejKnapp also to be true
    ' if you want the opposite then put a 'Not' before Active document

    ' e.g. Me.LJNejKnapp = Not ActiveDocument.Bookmarks("LJSidor1").Range.Font.Hidden

    ' If your radio buttons are grouped, so that selecting one automatically switches the others in the groups to off
    ' you only need one of the lines above per group.


End Sub
Let us know if this remommendation meets your needs.
Reply With Quote