Solved

Marking up a word document

Posted on 2003-11-12
2
373 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now