New topic: [Solved]Reading the contents of a textbox in a Word document
<http://forums.realsoftware.com/viewtopic.php?t=46997> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message Zudo Post subject: [Solved]Reading the contents of a textbox in a Word documentPosted: Tue Feb 19, 2013 10:05 am Joined: Wed Aug 15, 2012 1:49 am Posts: 4 Hi, Does anyone know how to loop through all of the textboxes in a word document and output the text they contain. I have tried the following code but can not get it to work. I keep getting a TypeMismatchException error on the msgbox. It doesn't help that the IDE does not show the TextFrame or the HasText after you have entered the period, followed by tab. Is this something missing in the IDE or am I doing something wrong? Dim word as New WordApplication Dim doc as WordDocument Dim f As FolderItem f = GetOpenFolderItem(FileTypes.ApplicationMsword) If f Is Nil Then Return End If if word is Nil then MsgBox "Word failed to open" return end if doc = word.Documents.Open(f.AbsolutePath) word.Visible = True word.Selection.Homekey(office.wdStory) msgbox word.ActiveDocument.Shapes.Count for i as integer = 1 to word.ActiveDocument.Shapes.Count if word.ActiveDocument.Shapes(i).TextFrame.HasText then msgbox word.ActiveDocument.Shapes(i).TextFrame.TextRange.Text end if next EDIT: In case anyone is interested. I needed to add the .Text to the end of the TextRange. Can't seem to get to the msdn.microsoft.com website today so had to google loads to try and find the answer. _________________ Regards Andy Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
