Solved

jquery-like closest property in Microsoft Word?

Posted on 2016-09-12
6
72 Views
Last Modified: 2016-09-12
I am automating Microsoft Word documents using the following structure

bookmark
h3 header
  table
      row
         cell
             Range.Text

Are there any properties or functions already available that would allow a statement such as the following or at least be usable to achieve
that capability?

myvar = mycell.closest("bookmark").find(h3).text
0
Comment
Question by:maxdbase
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 41794958
No, You would have to break it down to your precise requirements and write the code accordingly.

A Bookmark object has a Range property. A Range has a Start and an End property, so it would be possible to find another object with a Range property that is the nearest to the Start or to the End of the Bookmark Range
0
 

Author Closing Comment

by:maxdbase
ID: 41794961
That is a great start, thank you for helping me move forward.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 41794964
Note that in the case of defining the nearest for a table cell, it would be necessary to distinguish between the nearest cell in terms of the table, and the nearest in terms of the amount of separating text.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 76

Expert Comment

by:GrahamSkan
ID: 41794970
Thanks. If you need any more help with details later on, please post another question, Hopefully I, or another expert, will be able to assist.
0
 

Author Comment

by:maxdbase
ID: 41794974
Thanks a bunch, yes, I shall.   Have a great week!
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 41794985
Oops. I've now looked up what 'closest' means in Jquery. I see that it means traversing upwards in a hierarchy to find a match, so many of many the details in my comments are not applicable.
0

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question