|
-
Feb 17th, 2005, 10:52 AM
#1
Thread Starter
Lively Member
sending word text to a .txt file
Is there a way to select all of the text on an open word document through vba and send it to a .txt file?
Also could this be done continuously so that the word document and text file contain the same words?
What about formatting in word, is there a way of getting past this so that extra white space is not sent to the txt file?
Thanks
Last edited by smileyface5; Feb 17th, 2005 at 12:16 PM.
-
Feb 17th, 2005, 11:58 AM
#2
Re: sending word text to a .txt file
You mean like some kind of logger that writes the keypresses out to a textfile? Word already makes
backup copies of the document when it is being worked on, if the option is selected.
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 
-
Feb 17th, 2005, 12:02 PM
#3
Thread Starter
Lively Member
Re: sending word text to a .txt file
i need to run a perl module on the text. It works if run it on a .txt file however with all the formatting in word it goes crazy and cannot read it. Therefore i am sending all the text in the word document to a .txt file.
I would like to do it on keypress which i think would be done using a loop?
Also i am afraid that the formatting might still be sent to the .txt file and cause problems
-
Feb 17th, 2005, 12:09 PM
#4
Re: sending word text to a .txt file
Soundslike allot of issues may arrise if you do it on the keypress. You can do the
entire doc using the SaveAs method.
VB Code:
ActiveDocument.SaveAs FileName:="C:\DocumentText.txt", FileFormat:=wdFormatDOSText
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
|