Using a macro to parse a paragraph in a Word document

M

Molly J. Fagan

Hello--

I work for a law agency and I'm trying to incorporate VBA code that
was used in our in-house developed database (Access) into a Word
macro. My project also uses HotDocs (don't know if any of you are
familiar with that, if you are, is there any way to assign a HotDocs
variable to a Word variable or access a HotDocs variable through a
Word macro?), a tool that allows you to pull information from a
database into a Word or WordPerfect document--similar to Crystal
Reports.

For statute charge language, we have the elements delimited by angle
brackets and forward slashes (e.g. <caused the burning of/set fire
to>) and in the Access database, the code parses through and prompts
the user to choose an option or to type in information.

The HotDocs has a command for playing a macro without user
intervention. After the charge language is displayed, how can I have
my macro parse through a paragraph or paragraphs? I've looked at some
of the information about the range and paragraph but I don't know how
many paragraphs, how many charge languages will have to be parsed,
etc. It can, and will, be different every time. Is there a way that
I can delimit the paragraph(s) and have my macro search for a specific
character and start processing at that point and end when it
encounters an ending specific character?

Any help would be greatly appreciated.

Thanks.

Molly J. Fagan
 
J

Jezebel

Not quite sure what you're asking here. You can iterate the paragraphs of a
document or a selection:

Dim pParagraph as Word.Paragraph
For each pParagraph in ActiveDocument.Paragraphs (or
Selection.Paragraphs)
If Instr(pParagraph.range.text, "<") > 0 then ....

Next
 
J

JSM

In answer to your first question - there is no way that I am aware of to
directly access a Hotdocs variable from VBA. The usual approach would be to
have some sort of marker in you document followed by the Hotdocs variable
(eg [findme]«Hotdocs Variable») You would then find your marker (in this
case [findme]) then select the next word/line whatever the case may be and
assign the selection to a variable.

eg.

with selection.find
.text="[findme]"
.forward=true
.matchcase=false
.wrap=wdfindcontinue
end with

if selection.find.execute then
selection.delete
myWordVariable=selection.words(1)
end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top