Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB + Ms Word

Posted on 2002-07-11
1
Medium Priority
?
230 Views
Last Modified: 2010-05-02
Greetings,

I need to do the following :

1 - I have a Word document that has on its begining a table of Contents

an example would be like this

1 - nnnnn
 1-1 bbb
 1-2 hhhhh
  1-2-1 yyyyy

2 -mmmmm

3 - FFFFF
3-1 ttttt

and so on
.
.
.
.
.
.

What I need is to read this table of contents using VB ( loop through it and save it in the DB)


II - Split the document into section each section will beaccording to the Sections(1,1-1,1-2,1-1-1,...) defined in the Table of Contents and save each splitted part into a file

Can u Please help and please provide me with good links on how to use VB to read Word documents.

More Points for complete code

thnx a lot
0
Comment
Question by:zeon1234
[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
1 Comment
 
LVL 2

Accepted Solution

by:
chops123 earned 400 total points
ID: 7145650
Assuming that the TOC 'Contents' in the Word document are in a predifined format and the format doesnt chnage,you can read the word file,parse the contents of the page and strip out the required sections.

For this you need an identifier on which you would base your parsing on.In this case I beleive you have to rely on vbCrLf (Carriage Return-Line Feed)

Use the instr and Mid functions in VB to go about your parsing.

Regards
KC
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses

704 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