ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Question about Word export to excel? (https://www.excelbanter.com/excel-worksheet-functions/99537-question-about-word-export-excel.html)

Mr BT

Question about Word export to excel?
 
I cannot find a newsgroup for Word, it this might be applicable to what is
covered in this newsgroup so I'm going to ask this anyways...

Is there a way i can export the list of Bookmarks from a Word file ?

thx
Mr BT



Chip Pearson

Question about Word export to excel?
 
In the VBA Editor, go to the Tools menu, choose References, and
select Microsoft Word. Then use code like the following:

Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Dim Rng As Excel.Range
Dim BM As Word.Bookmark


Set Rng = Range("A1")
On Error Resume Next
Set WordApp = GetObject(, "Word.Application")
If WordApp Is Nothing Then
Set WordApp = CreateObject("Word.Application")
End If
If WordApp Is Nothing Then
MsgBox "Unable to access Word"
Exit Sub
End If

Set WordDoc = WordApp.Documents.Open(Filename:="H:\Test.doc")
'<<< CHANGE
For Each BM In WordDoc.Bookmarks
Rng.Value = BM.Name
Set Rng = Rng(2, 1)
Next BM



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Mr BT" wrote in message
news:z0tug.190415$iF6.35041@pd7tw2no...
I cannot find a newsgroup for Word, it this might be applicable
to what is covered in this newsgroup so I'm going to ask this
anyways...

Is there a way i can export the list of Bookmarks from a Word
file ?

thx
Mr BT





All times are GMT +1. The time now is 04:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com