Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-23-2013, 06:32 AM
bobk544 bobk544 is offline Can no longer read and save WORD documents as TXT files Windows 7 32bit Can no longer read and save WORD documents as TXT files Office 2010 32bit
Novice
Can no longer read and save WORD documents as TXT files
 
Join Date: Apr 2009
Posts: 10
bobk544 is on a distinguished road
Default Can no longer read and save WORD documents as TXT files

Hello, after getting a new Windows7 work PC, i can no longer programatically read WORD documents from a C# program and SAVE those WORD documents as new TXT files, but on my previous Windows7 work PC, I was able to read WORD documents and SAVE those WORD documents as new TXT files programatically using C#.



Also, on my new work PC, i don't have ADMIN rights, but i didn't have ADMIN rights on my previous work PC and was able to generate new TXT files from WORD documents programatically.

So for now, i'm transferring my WORD documents to my personal Windows8 machine at home and generating the TXT files there and tranferring the TXT files back to my Windows7 work machine.

I also checked the WORD option settings on my work PC and didn't see anything in particular that seemed to be blocking the reading and saving of WORD documents to a TXT file format ie:

Code:
Microsoft.Office.Interop.Word.Application newApp = new Microsoft.Office.Interop.Word.Application();
 
object miss = System.Reflection.Missing.Value; object path = pathin; object readOnly = false;
 
Document doc = newApp.Documents.Open(destFile, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);
 
object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocument;
 
object nFileName = pathin + "\\" + fileName + ".txt"; object FileFormat = 
Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatText;
 
object oMissing = System.Reflection.Missing.Value;
 
doc.SaveAs(ref nFileName, ref FileFormat, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
doc.Close();
Might anyone know if there is a WORD option setting i need to turn on or turn off or a configuration i need to change that will enable the reading and saving of WORD documents to TXT files programatically?

Thanks very much for any ideas! BobK
Reply With Quote
  #2  
Old 11-23-2013, 10:48 PM
macropod's Avatar
macropod macropod is offline Can no longer read and save WORD documents as TXT files Windows 7 32bit Can no longer read and save WORD documents as TXT files Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Have you installed your C# software (Visual Studio?) on the new PC? Do other aspects of the code work as expected? Does whatever path 'pathin' refers to exist on the new PC and do you have write permissions to that folder?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-24-2013, 07:22 AM
bobk544 bobk544 is offline Can no longer read and save WORD documents as TXT files Windows 7 32bit Can no longer read and save WORD documents as TXT files Office 2010 32bit
Novice
Can no longer read and save WORD documents as TXT files
 
Join Date: Apr 2009
Posts: 10
bobk544 is on a distinguished road
Default

Thanks Paul how have you been? long time no talk too! Paul you got me thinking about the fact that my new Visual Studio Express setup may not be compatible, so i put in a try catch around that routine and got the following exception:
Exception:Exception:System.MissingMethodException: Method not found: 'System.Type System.Runtime.InteropServices.Marshal.GetTypeFrom CLSID(System.Guid)'.
And when i googled it, it mentioned a possible versioning difference, so when i changed the Visual Studio version number back to to 4.0 from 4.5 its now working!

And Paul, i just wanted to mention that the reason i'm converting WORD documents to TXT, is mainly to build a cross reference to fields that are in the WORD documents and even though i can't specifically hyperlink to a specific word value location in the document, i can know if a specific word value is in a particular WORD document and when i jump to the beginning of the document, i can then use that bookmark/hyperlink tool you helped me build which is working pretty good now!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can no longer read and save WORD documents as TXT files After Word crash, can no longer save as .docx mrwednesday Word 4 10-15-2013 01:21 AM
mouse no longer works inside word documents? trob Word 0 02-01-2012 11:36 AM
Word documents suddenly and randomly open read only Jennifer Murphy Word 0 09-03-2011 10:13 PM
Read text from word documents using VBA? maxald Word VBA 0 08-17-2010 06:51 AM
Can't save word document in anything but read format Stuckie Word 0 01-21-2010 12:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft