General information
Category:
COM/DCOM and OLE Automation
Title:
Problem with Word method
I have a problem, I dont know how to execute a Word method form VFP
At the sample below I want to protect the document, but it allways returns an
error when I call the method Protect, it returns a OLE error: unknown name
Word2000/VFP6.0 + SP5
Could someone help me please
TIA
oWordApplication = CREATEOBJECT("Word.Application")
oWordApplication.VISIBLE = .F.
oWordApplication.Documents.ADD("normal.dot", .F.)
* Select the document
oSelection = oWordApplication.ActiveWindow.ActivePane.SELECTION
oSelection.TypeText ("Test to protect this document.")
* Select Range ( all text form the document )
oSelection2 = oWordApplication.ActiveWindow.ActivePane.SELECTION.range
IF oWordApplication.ActiveDocument.ProtectionType = wdNoProtection && no protection
WITH oSelection2
.PROTECT
.TYPE = wdAllowOnlyFormFields
.PASSWORD = "free"
ENDWITH
ENDIF
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only