Y
yl358
So I have all these word documents with the same format. They have all
these textboxes that contain "name", "date", "state", "telephone #",
etc., respectively.
I'm trying to create a database using these .doc files. One way is to
manually open all the .doc files and manually type into Excel the name,
date, state, telephone, etc into each column. But this is tedious!
I'm sure there's a way for Excel to search all the textboxes from Word
and automatically transfer it all into one Excel database.
I found something on the web that converts Word Comments into Excel. I
think it would help in what I'm trying to do:
--------------------------------------------------------------
Public Sub PullWordNotes()
Dim WordApplication As Word.Application
Dim WordDocument As Word.Document
Dim DocumentPath As String
Dim TargetComment As Word.Comment
Dim DestSheet As Worksheet
Dim DestRow As Long
Set WordApplication = New Word.Application
DocumentPath = Application.GetOpenFilename(FileFilter:="Microsoft
Word Files (*.doc),*.doc", Title:="Select template narrative Word
document")
If DocumentPath = "False" Then
Exit Sub
End If
Set WordDocument = WordApplication.Documents.Open(DocumentPath,
ReadOnly:=True)
Set DestSheet = Sheets("Sheet1")
DestSheet.Cells.ClearContents
DestSheet.[A1] = "Comment"
DestSheet.[B1] = "Referenced Text"
DestRow = DestSheet.[A65536].End(xlUp).Row
For Each TargetComment In WordDocument.Comments
DestSheet.[A2:A65536].Cells(DestRow) = TargetComment.Range.Text
DestSheet.[B2:B65536].Cells(DestRow) = TargetComment.Scope.Text
Next TargetComment
WordDocument.Close False
WordApplication.Quit
End Sub
--------------------------------------------------------------
Now... that just transfers Comments from Word. I'm trying to transfer
Text Boxes from Word. I'm knowledgable in VBA, but I cannot frind the
TextBox counterpart to Comments. All I found was Controls,
ControlCollections, but I don't know how to make it work.
Anyone got any suggestions? Thanks
these textboxes that contain "name", "date", "state", "telephone #",
etc., respectively.
I'm trying to create a database using these .doc files. One way is to
manually open all the .doc files and manually type into Excel the name,
date, state, telephone, etc into each column. But this is tedious!
I'm sure there's a way for Excel to search all the textboxes from Word
and automatically transfer it all into one Excel database.
I found something on the web that converts Word Comments into Excel. I
think it would help in what I'm trying to do:
--------------------------------------------------------------
Public Sub PullWordNotes()
Dim WordApplication As Word.Application
Dim WordDocument As Word.Document
Dim DocumentPath As String
Dim TargetComment As Word.Comment
Dim DestSheet As Worksheet
Dim DestRow As Long
Set WordApplication = New Word.Application
DocumentPath = Application.GetOpenFilename(FileFilter:="Microsoft
Word Files (*.doc),*.doc", Title:="Select template narrative Word
document")
If DocumentPath = "False" Then
Exit Sub
End If
Set WordDocument = WordApplication.Documents.Open(DocumentPath,
ReadOnly:=True)
Set DestSheet = Sheets("Sheet1")
DestSheet.Cells.ClearContents
DestSheet.[A1] = "Comment"
DestSheet.[B1] = "Referenced Text"
DestRow = DestSheet.[A65536].End(xlUp).Row
For Each TargetComment In WordDocument.Comments
DestSheet.[A2:A65536].Cells(DestRow) = TargetComment.Range.Text
DestSheet.[B2:B65536].Cells(DestRow) = TargetComment.Scope.Text
Next TargetComment
WordDocument.Close False
WordApplication.Quit
End Sub
--------------------------------------------------------------
Now... that just transfers Comments from Word. I'm trying to transfer
Text Boxes from Word. I'm knowledgable in VBA, but I cannot frind the
TextBox counterpart to Comments. All I found was Controls,
ControlCollections, but I don't know how to make it work.
Anyone got any suggestions? Thanks