AboutRobert Nunemaker Expertise String manipulation, Database access and usage, Class creation, and
encapsulation are my strong suits. Active X Controls and DLL`s also.
Although I don`t deal with Crystal - frankly because I don`t like it; I
prefer to do things manually.
Experience Employment history: Programmed with the Air Force for 15 years, and have continued in the private sector for the past 1 year. Used VB (all versions) for the past 8 years.
Question Back on 4/28/07 on this forum Jonathan Roach provided the code below for printing the content of a text box in Word to a file. The code assumed that the text box was "Text1." I need to print the content of every text box in a document. I know I can use "Open "c:\filename.ext" For Append As #1" to add each content to the file, but how do I find every text box. (Assume the text boxes are all in the main body of the document, not in headers, footers, etc.) Thank you very much!
'Begin Code
Open "c:\filename.ext" For Output As #1
Print #1, Text1.Text
Close #1
'End Code
Answer In Word 2007, text boxes are slightly different. They are "Shapes".
So, use:
Dim Doc As Word.Document
Dim oShape As Word.Shape
Set Doc = ActiveDocument
For Each oShape In Doc.Shapes
Debug.Print "Name: " & oShape.Name & ", Text: " _
& Replace(oShape.AlternativeText, "Text Box: ", "")
Next