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
Solved

Marking up a word document

Posted on 2003-11-12
2
377 Views
Last Modified: 2010-05-01
Hello,

This isn't necessarily a VB question, but I'm hoping the experts here may have some ideas for me.

I have a client who receives word documents from many of their clients.  These documents they receive are not consistently formatted.  When they receive the doc, they have to manually copy and paste information from the doc into a separate text file.

The customer is looking for a way to streamline their process.  Any solution I provide has to use the Word document as a starting point.  They have no way of controlling the files they recieve.

My hope is that there is some way within Word to be able to highlight a block of text and mark it with a tag that identifies it as a certain piece of information.  Then I would write some code to parse through the document and generate the text file based on the tags that have been marked in the document.

I have a few questions:
- Is what I am talking about possible?
- If so, can you point me in the direction of how to start this?
- If not, do you have any other ideas of how to solve their problem?

Thank you very much for your help in this matter.

DG
0
Comment
Question by:d_glenn
2 Comments
 
LVL 7

Accepted Solution

by:
_agj_ earned 250 total points
ID: 9739278
this code, when used in vba will print out a list of hightlighted sections, one after the otehr

Dim sent As String
Dim i As Long

For i = 1 To ThisDocument.Words.Count
If ThisDocument.Words(i).HighlightColorIndex <> wdNoHighlight Then
    If ThisDocument.Words(i + 1).HighlightColorIndex = wdNoHighlight Then
        sent = sent & " " & ThisDocument.Words(i)
        Debug.Print sent
        sent = ""
    Else
        sent = sent & " " & ThisDocument.Words(i)
    End If
End If

Next i

to use from vb, include a word reference and replace thisdocument with :
dim doc as document
set doc = Word.Application.Documents.Open(FileName)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

792 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