Discussion Locked

Accessing Text from Word TextBox

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

i have been working on lots of word document files having same format of data.

i cant access the text written in word textbox.

i tried a lot but couldn't succeeded.

need help badly...................

8 replies

by jkorchok

The easy part is working with the text:

Selection.ShapeRange.TextFrame.TextRange.Text

will give you access once the textbox is selected. The tricky part is selecting it in the first place. You can loop through the shape collection and select shapes that are in a known location (test for Top and Left properties), or if you know the name of the textbox, you can select it using that.

by sunil.kumarpv

Hi,

i have a similar problem.

1) Through a macro, i should be able to open word document one by one which has a textbox with content, the content should be read and stored in a variable(in macro). Is there a way to read the texbox content and format it. Please provide code for this if you have.

2) Once the content is read in well format, i should be able to add this to the property with a name and value to each of these word documents(To manually add a property to a document you can go to File > Properties and Custom Tab).

I hope this macro should be programmed in Normal.dot ? Please help if you can. Please email me if you need any further clarifications. My email id is sunil (dot) kumarpv (at) paconsulting.com

by sunil.kumarpv

Hi,

i have a similar problem.

1) Through a macro, i should be able to open word document one by one which has a textbox with content, the content should be read and stored in a variable(in macro). Is there a way to read the texbox content and format it. Please provide code for this if you have.

2) Once the content is read in well format, i should be able to add this to the property with a name and value to each of these word documents(To manually add a property to a document you can go to File > Properties and Custom Tab). This should be done dynamically through Macro.

I hope this macro should be programmed in Normal.dot ? Please help if you can. Please email me if you need any further clarifications. My email id is sunil (dot) kumarpv (at) paconsulting.com

by silly

nobody there help me with it

i have been succeeded in accessing those word files one by one and copy data from it.

but the problem still remaining with the macro.
i can run macro throug vb code but can't record a macro.

coz some of the text is copied through macro and pasted in wordfile through the same macro.

but i dont know how to do this recording a macro through vb code.

plzzzzzzzzzz reply me asap.

thanks in advance

by jkorchok

It's not clear what you are trying to accomplish, so it's not possible to help.

Why would you even want to use a macro to record another macro? You don't need that to copy and paste text.

by silly

actually i have some fields in MSWord that can only be retrived through macro.

what i have to do is to open the word file having data. then copy e.g name, address, location and date
by running word macro and paste it in the file.

by jkorchok

Maybe you're trying to read Text Formfields, in which case you would use:
ActiveDocument.FormFields("FieldName").Result
Maybe you are trying to read a merge field. Maybe you're trying to read an ActiveX control. You want to paste the info in a file. Which file? The same one you're working in? Another file? Why are you trying to do this in VB? Why not just do it in VBA?
I don't know, because you don't communicate the problem well, which probably indicates that you haven't really thought it through, which is probably why you can't solve it. The more effort you put into explaining the problem clearly, the more likely you are to actually find a solution.

by sunil.kumarpv

Hi,

i have a similar problem.

1) Through a macro, i should be able to open word document one by one which has a textbox with content, the content should be read and stored in a variable(in macro). Is there a way to read the texbox content and format it. Please provide code for this if you have.

2) Once the content is read in well format, i should be able to add this to the property with a name and value to each of these word documents(To manually add a property to a document you can go to File > Properties and Custom Tab). This should be done dynamically through Macro.

I hope this macro should be programmed in Normal.dot ? Please help if you can. Please email me if you need any further clarifications. My email id is sunil (dot) kumarpv (at) paconsulting (dot) com

This discussion is closed to new replies.