Author | Topic: XBase code equivalent for selection object | |
---|---|---|
Bruce Anderson | XBase code equivalent for selection object on Tue, 22 Feb 2011 15:05:10 -0600 I have VBA code which I am trying to convert to XBase++ Specifically, I am writing values to FormField objects in a MS Word document. oFormFields := oDoc:FormFields oField := oFormFields:item(n) where oField:type = wdFieldFromTextInput and oField:TextInput:type = wdRegularText. if len(cString) < 255 oField:Result := cString this works fine. However, long strings have to be handled differently. I have working VBA code for this instance. It selects the specific FieldForm from the FieldForms collection, and then uses the Selection object this way: lcol_FormFields(ls_FormField).Select I assume this is the same as my oField object. Selection.TypeText (ls_AnswerValue & " " ) I don't know how to write this in XBase++. I have tried every combination I can imagine and nothing works. "TypeText" is a method of the Selection object. I really don't know truly what a Selection object is in this case. It isn't simply oField, or oField:select(), because neither of these have the TypeText method. If I can get a Selection object, I think oSelection:TypeText( cString ) will work. Help, please. | |
Ronald van Veelen | Re: XBase code equivalent for selection object on Wed, 23 Feb 2011 13:41:17 +0100 Op Tue, 22 Feb 2011 15:05:10 -0600 schreef Bruce Anderson: > I have VBA code which I am trying to convert to XBase++ > Specifically, I am writing values to FormField objects in a MS Word > document. > > oFormFields := oDoc:FormFields > oField := oFormFields:item(n) > where oField:type = wdFieldFromTextInput and oField:TextInput:type = > wdRegularText. > if len(cString) < 255 > oField:Result := cString this works fine. > > However, long strings have to be handled differently. I have working VBA > code for this instance. It selects the specific FieldForm from the > FieldForms collection, and then uses the Selection object this way: > lcol_FormFields(ls_FormField).Select I assume this is the same > as my oField object. > Selection.TypeText (ls_AnswerValue & " " ) > > I don't know how to write this in XBase++. I have tried every combination I > can imagine and nothing works. > "TypeText" is a method of the Selection object. > I really don't know truly what a Selection object is in this case. It isn't > simply oField, or oField:select(), because neither of these have the > TypeText method. > If I can get a Selection object, I think oSelection:TypeText( cString ) > will work. > > Help, please. Hi Bruce, Try this (This will replace): oField:select() oDoc:application:selection:typeText(cReplace/cString) OR (this will insert) oField:result:insertBefore(cString) Hope that helps. Haven't tested it. Best regards, Ronald van Veelen |