Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't no one answer this?(VBA Question)\

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I've posted this one days ago, but no one really answered it... I wonder if this is such a difficult thing to do.
I need to find a specific character on a msword document using VBA(this is easy to do) and now I need to store the position of this character on the document on another variable... I suppose there is a function for this right? Possibly one that would give me the x-y coordinates of that position(something like xpos or ypos?) or an absolute position based on the total number of characters from the beginning of the document?

Has anyone ever used this or know how to do it?

Thanx.
 
How are you reading the file? If you use FileSystemObject.ReadLine, you could store the line number that the character is on, then use InStr to find which position it's at.

Let me know if you need more info on how to do this.
 
Thanks for your reply. I'll try this but I'm not sure if it will work good enough because if the user resizes the paper size of the word document after the program has found the character, the line number where that character is will be different so in this case it wouldn't work.
It's because of this that I needed an absolute position of the character. Now that I think of it I could select the whole text and to a InStr to it... And store the position, but if I do this how could I write to this position later? I mean how could I move the cursor to that specific position by code?
If you could give me some help I'd appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top