Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with Word method
Message
From
11/05/2001 19:29:11
Peter Wagner
Point Informática Ltda.
Limeira, Brazil
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Problem with Word method
Miscellaneous
Thread ID:
00506528
Message ID:
00506528
Views:
63
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
Map
View

Click here to load this message in the networking platform