insert text at cursor position 
Author Message
 insert text at cursor position

Is this possible?  I have a custom combo box where the user selects a custom
mail merge code and clicks a button to insert that code in the document.  I
want to insert the text of the combo box where the cursor is currently
located in the document.  However, the following line of code only inserts
my text at the beginning of the document.

ActiveDocument.Content.InsertBefore Text:=CBmergecodes.Text

What am I missing?  It seems like there should be a simple way to do this.



Sun, 27 Apr 2003 03:00:00 GMT  
 insert text at cursor position

Hi Jody,

If you want to add your text after the selection in the document, use :
    selection.InsertAfter text:= CBmergecodes.Text
if you want to replace the selection, use:
    selection.Text = CBmergecodes.Text

Hope this helps,
regards,
Astrid

For direct access to all Microsoft newsgroups:



Quote:
> Is this possible?  I have a custom combo box where the user selects a
custom
> mail merge code and clicks a button to insert that code in the document.
I
> want to insert the text of the combo box where the cursor is currently
> located in the document.  However, the following line of code only inserts
> my text at the beginning of the document.

> ActiveDocument.Content.InsertBefore Text:=CBmergecodes.Text

> What am I missing?  It seems like there should be a simple way to do this.



Sun, 27 Apr 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. inserting text at cursor position

2. Inserting Text in TextBox at the position of Cursor

3. Inserting Text in TextBox at the position of Cursor

4. Text box cursor position when text is selected

5. insert at cursor position

6. Inserting a range at the cursor position

7. Insert text into text box on current position

8. Cursor position in text box

9. Mark text from cursor position until next tab sign

10. Add text at cursor position?

11. Positioning the Cursor in the first text box of a User Form

12. Text Cursor Position in document

 

 
Powered by phpBB® Forum Software