Hi yet again Richard,
After my previous effort which I now think was not what you are looking for
I felt bound to have another look at the problem and perhaps the following
might help.
It does assume that you are using FormText fields for the user to complete
with the form protected. If the form is not protected when the user fills in
the data, the field names disappear.
You then need to unprotect the document to run the code or it cannot select
the data.
If anyone has a better answer then feel free to post it because I am also
interested.
Sub Get_FormText()
Dim PathFileName
Dim objWord
Dim Variable1
Dim Variable2
PathFileName = CurDir & "\" & "DocVariable Copy Test.doc"
Set objWord = CreateObject("Word.Application")
With objWord
.Documents.Open PathFileName
.Visible = True
'Get data from a Word document DocVariable
.ActiveDocument.bookmarks("Text1").Select
Variable1 = .Selection
.ActiveDocument.bookmarks("Text2").Select
Variable2 = .Selection
End With
MsgBox "Text1 = " & Variable1 & Chr(13) & _
"Text2 = " & Variable2
End Sub