Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting formfields in MS Word from VFP 6.0

Status
Not open for further replies.

aiden

Programmer
Apr 23, 2001
27
CA
Hi,

I'm trying to create some formfields (textboxes) in MS Word 2002 from VFP 6.0. I can create the textboxes where I want them. However, when I try to set the textinput properties, I get a 'Command failed' error even though the properties are successfully changed. Needless to say, I'm trying to eliminate the error message.

Here's the VBA code I copied from a Word Macro and the VFP Code I'm trying.

Any Suggestions? Thanks in advance.

VBA
With Selection.FormFields(1)
.Name = "txtRate_33"
With .TextInput
.EditType Type:=wdNumberText, Default:="", Format:="#,##0.00"
End With
End With

VFP 6.0
Selection.FormFields(1).TextInput.EditType(1,"","#,##0.00")

&&wdNumberText = 1
 
This may help pointing you in the right direction.

If the operations actually succeed, place your code
in an object function and trap for the error in the
error() event. Although it's better to actually know why
it's happening.

Darrell

e.g.

DEFINE CLASS WordOps AS CUSTOM

PROCEDURE SetFormFields
* Whatever your set up code is...
SELECTION.FormFields(1).TextInput.EditType(1,"","#,##0.00")
*...
*...
ENDPROC

PROCEDURE ERROR(nErrNum, cMethod, nLine)
LOCAL ARRAY laErrors[1]
AERROR(laErrors)
DO CASE
CASE nErrNum == 1429
IF UPPER(laError[3])=="COMMAND FAILED"
RETURN && Just return since the operation succeeded
ENDIF

CASE nErrNum == {OTHER conditions!}

ENDCASE
ENDPROC
ENDDEFINE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top