PDA

View Full Version : Solved: Insert text in document using VBA



Solrac3030
02-07-2007, 01:13 PM
I'm trying to find a way of inserting specific text at the cursor point in a document using VBA. This is for inserting citations in legal document. In some instances there may be more than one version of the citation and the user has tp select the correct version using radio buttons. Once the selection is made the user would click on the OK button and the text would be inserted where the cursor was located and could then continue typing the document. I know how to creat the forms and run the the code I have just not been able to figure how to paste the text in the diocument. Any help would be appreciated.

Thanks.

lucas
02-07-2007, 03:03 PM
This works to enter a string:
Selection.TypeText Text:="Your Text Here"
or this for a textbox value:
Selection.TypeText Text:=Textbox1.value

Solrac3030
02-08-2007, 12:12 PM
Thanks for that line of code. Solves my problem.

lucas
02-08-2007, 01:51 PM
Be sure to mark your thread solved using the thread tools at the top of the page....