Home > database >  How to write characters in the WORD's text box?
How to write characters in the WORD's text box?

Time:09-20

Hypothesis: a DOCX document, there are two text boxes, want to write in the first text box "is the first text box", the second text box writes "the second text box," strives for the code, thank you,

Here is my recording macros, don't know how to write code
Sub macro (4)
'
"Acer 4
'
'
ActiveDocument. Shapes. Range (Array (" text box 2 ")). Select
Selection. TypeBackspace
Selection. TypeBackspace
Selection. TypeBackspace
Selection. TypeBackspace
Selection. TypeText Text:="the first Text box"
ActiveDocument. Shapes. Range (Array (" text box 2 ")). Select
Selection. TypeBackspace
Selection. TypeBackspace
Selection. TypeBackspace
Selection. TypeText Text:="the second Text box"
End Sub

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
OWrd=CREATEOBJECT (" Word. Application ")
Owrd. Documents. The Open (GETFILE (" DOCX ")) & amp; & Open the existing document
Owrd. Visible=. T.
Owrd. ActiveDocument. Shapes (2). The Range, the text="KKK" & amp; & The trip operation error, according to?
* owrd. ActiveDocument. Shapes. Range (Array (" text box 2 "). The Range. The text="KKK"

CodePudding user response:

Done, junction post

OWrd=CREATEOBJECT (" Word. Application ")
Owrd. Documents. The Open (GETFILE (" DOCX ")) & amp; & Open the existing document
Owrd. Visible=. T.
* with owrd
Owrd. ActiveDocument. Shapes. The Range (1). Select
Owrd. Selection. Range. The text="the first text box"

Owrd. ActiveDocument. Shapes. Range. (2) Select
Owrd. Selection. Range. The text="the second text box"
* ENDWITH
  •  Tags:  
  • VFP
  • Related