Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement