How to find out the value of a flag in a word file (* .doc) in VB.net using a Range object?

How to find out the value of a flag in a word file (* .doc) in VB.net using a range object?

This is what I have so far:

Dim app As New Word.Application
Dim doc As Document
doc = app.Documents.Open("C:\myDoc.doc")
dim chkBox as Bookmark
chkBox = doc.Bookmarks("MyCheckbox")
Dim rng as Range
rng = chkBox.Range

where "MyCheckbox" is the flag tab in the word document.

+5
source share
1 answer

Any specific reason why you are not reading the value of the flag using the name of the flag itself?

, , , , , , InlineShapes ( ), Shapes ( .)

Shapes InlineShapes, .

InlineShapes

Dim ctl As InlineShape
For Each ctl In rng.InlineShapes
    If ctl.Type = wdInlineShapeOLEControlObject Then
        If ctl.OLEFormat.ClassType Like "Forms.CheckBox*" Then
            'current version of ctl is a checkbox, do what you will with it.

        End If
    End If
Next ctl
...

, , .

+1

All Articles