|
-
Aug 6th, 2001, 03:31 AM
#1
Thread Starter
New Member
Getting list of bookmarks from a Word file
Hi,
Does anyone know how to programmtically get a list of bookmarks within a named Word document?
thanks,
Tom
-
Aug 7th, 2001, 12:32 AM
#2
-= B u g S l a y e r =-
VB Code:
'----------------------------------------
'- Name: peet
'- Web:
'- Company: PvP
'----------------------------------------
'- Notes: Lists all bookmarks and fiels
' found in a word doc.
'----------------------------------------
'To test this, Create a new vb project. Add two listboxes and a command button to the form.
Option Explicit
Private objWord As Word.Application
Private wd As Word.Document
Private Sub Command1_Click()
Dim i As Integer
If objWord Is Nothing Then
Set objWord = CreateObject("Word.Application")
Else
Set objWord = GetObject(, "Word.Application")
End If
DoEvents
Set wd = objWord.Documents.Open("c:\Test.doc")
List1.Clear
List2.Clear
For i = 1 To wd.FormFields.Count
List1.AddItem wd.FormFields(i).Name
Next
For i = 1 To wd.Bookmarks.Count
List2.AddItem wd.Bookmarks(i).Name
Next
objWord.Quit False
End Sub
-
Aug 7th, 2001, 12:55 AM
#3
Thread Starter
New Member
-
Aug 7th, 2001, 12:56 AM
#4
-= B u g S l a y e r =-
Your welcome Tom
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|