|
-
Jul 26th, 2005, 07:00 AM
#1
Thread Starter
New Member
Extracting Text from word TextBox
Dear Helpers
i have been working on word Document files.
each document has same text format.
i m using the code below to extract text from it,
Code:
Dim sFileName As String 'Name of files within the folder will be stored
Dim i As Integer 'This will count the files read***
Dim wrd As Word.Application
Dim wrdCount As Long 'Number of characters within the file
'Get the first file with extension "DOC" ***
sFileName = Dir$("C:\Virology\*.DOC") '***
Do While sFileName <> "" '***
Set wrd = New Word.Application 'Create obj of word application
wrd.Visible = False
wrd.Documents.Open "C:\Virology\" & sFileName
wrdCount = wrd.Documents(1).Characters.Count
Text1.Text = Text1.Text & vbCrLf & i & wrd.Documents(1).Range(0, wrdCount).Text
wrd.Documents(1).Close
Set wrd = Nothing
sFileName = Dir$ '***
i = i + 1
Loop
This works good for all the characters in the document but the problem rises when word textbox appears in the document.
-
Jul 26th, 2005, 04:40 PM
#2
Re: Extracting Text from word TextBox
There are four types of textboxes.
ActiveX Textbox
Shape Textbox
WordArt Textbox
Forms Textbox
You need to find out which you used in the doc as they all require different methods to read.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|