Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Reading Word TextBoxes and Transferring Contents to Excel


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


--
yl358
------------------------------------------------------------------------
yl358's Profile: http://www.excelforum.com/member.php...o&userid=35776
View this thread: http://www.excelforum.com/showthread...hreadid=559801

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Reading Word TextBoxes and Transferring Contents to Excel


Oh, I also forgot to ask: what do I reference?


--
yl358
------------------------------------------------------------------------
yl358's Profile: http://www.excelforum.com/member.php...o&userid=35776
View this thread: http://www.excelforum.com/showthread...hreadid=559801

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Reading Word TextBoxes and Transferring Contents to Excel


Ok I solved the problem for those who want a solution:

Dim DestString As String
DestString = WordDocument.Shapes("Text Box
7").TextFrame.TextRange.Text

Now I have another problem, albeit minor one. The String always ends
with a square symbol. It looks like a small, blocky zero and always
appears at the end of every string that the .Text method returns.
What's up with this? I did the hard part already, so please help!


--
yl358
------------------------------------------------------------------------
yl358's Profile: http://www.excelforum.com/member.php...o&userid=35776
View this thread: http://www.excelforum.com/showthread...hreadid=559801

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transferring Excel chart into MS Word jane Excel Discussion (Misc queries) 2 July 3rd 07 02:30 PM
Transferring from Excel to Word Hnelg Excel Discussion (Misc queries) 3 June 7th 06 12:51 AM
Transferring Excel Data to Word Document maacmaac Excel Programming 1 October 7th 05 07:38 AM
Transferring Excel Data to Word Document maacmaac Excel Discussion (Misc queries) 0 October 6th 05 05:23 PM
Transferring cell data to textboxes Merlin Excel Programming 1 October 5th 05 06:47 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"