<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Reading Word Documents in WSH</title>
	<link>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/</link>
	<description>Ask the Windows Guru!</description>
	<pubDate>Sun, 01 Aug 2010 06:22:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Jay</title>
		<link>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87372</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Wed, 05 May 2010 17:36:41 +0000</pubDate>
		<guid>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87372</guid>
		<description>I will give that a try.

thanks again!</description>
		<content:encoded><![CDATA[<p>I will give that a try.</p>
<p>thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilpo</title>
		<link>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87241</link>
		<dc:creator>Nilpo</dc:creator>
		<pubDate>Tue, 04 May 2010 19:04:32 +0000</pubDate>
		<guid>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87241</guid>
		<description>Jay,

It sounds like you might be using Word 2007.  It uses a separate file format for macro-enabled documents.  In your code, you specify the Save As type as RTF (which doesn't support macros) so when Word closes, it still wants to save the open macro-enabled document.  Try using:

Dim type As Object = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLDocumentMacroEnabled</description>
		<content:encoded><![CDATA[<p>Jay,</p>
<p>It sounds like you might be using Word 2007.  It uses a separate file format for macro-enabled documents.  In your code, you specify the Save As type as RTF (which doesn&#8217;t support macros) so when Word closes, it still wants to save the open macro-enabled document.  Try using:</p>
<p>Dim type As Object = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLDocumentMacroEnabled</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87239</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Tue, 04 May 2010 18:35:05 +0000</pubDate>
		<guid>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87239</guid>
		<description>It works!

i tested another word app, if it doesn't have complex macros, then the word doc will close without any prompts.  If it has complicated macros embedded, then it won't.

since 99% of the word files i'll be reading will have narrative, i'm good.

thank you again for your time and consideration!</description>
		<content:encoded><![CDATA[<p>It works!</p>
<p>i tested another word app, if it doesn&#8217;t have complex macros, then the word doc will close without any prompts.  If it has complicated macros embedded, then it won&#8217;t.</p>
<p>since 99% of the word files i&#8217;ll be reading will have narrative, i&#8217;m good.</p>
<p>thank you again for your time and consideration!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87238</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Tue, 04 May 2010 18:26:18 +0000</pubDate>
		<guid>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87238</guid>
		<description>Sorry,

In the post, the Dim saveChanges has the wdSaveChanges instead of the wdDoNotSaveChanges because i was still testing

also, i close the word document, your objDoc with the wdDoNotSaveChanges, thus should be able to just quit the application without having to reference the wdDoNotSaveChanges again...

However, for testing purposes, I have included both, as you will notice below

but whether I have saveChanges = to wdSaveChanges or wdDoNotSaveChanges, it still gives me the prompt...

for the sake of it, i even iterate through the documents within the app, just in case there's more than one and auto save the file before closing the doc with the saveChanges variable...which is set to wdDoNotSaveChanges

nme = path.Substring(path.LastIndexOf("\") + 1)
                nme = nme.Substring(0, nme.LastIndexOf(".")) + ".rtf"
                wApp.Visible = False
                wDoc = wApp.Documents.Open(path, , True)
                wDoc.Activate()

                nme = path.Substring(0, path.LastIndexOf("\") + 1) + nme
                Dim type As Object = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF
                wDoc.SaveAs(nme, Type)

                Dim saveChanges As Object = Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges
                For Each doc As Microsoft.Office.Interop.Word.Document In wApp.Documents
                    doc.Save()
                    doc.Close(saveChanges)
                Next
                wApp.Quit(saveChanges)</description>
		<content:encoded><![CDATA[<p>Sorry,</p>
<p>In the post, the Dim saveChanges has the wdSaveChanges instead of the wdDoNotSaveChanges because i was still testing</p>
<p>also, i close the word document, your objDoc with the wdDoNotSaveChanges, thus should be able to just quit the application without having to reference the wdDoNotSaveChanges again&#8230;</p>
<p>However, for testing purposes, I have included both, as you will notice below</p>
<p>but whether I have saveChanges = to wdSaveChanges or wdDoNotSaveChanges, it still gives me the prompt&#8230;</p>
<p>for the sake of it, i even iterate through the documents within the app, just in case there&#8217;s more than one and auto save the file before closing the doc with the saveChanges variable&#8230;which is set to wdDoNotSaveChanges</p>
<p>nme = path.Substring(path.LastIndexOf(&#8221;\&#8221;) + 1)<br />
                nme = nme.Substring(0, nme.LastIndexOf(&#8221;.&#8221;)) + &#8220;.rtf&#8221;<br />
                wApp.Visible = False<br />
                wDoc = wApp.Documents.Open(path, , True)<br />
                wDoc.Activate()</p>
<p>                nme = path.Substring(0, path.LastIndexOf(&#8221;\&#8221;) + 1) + nme<br />
                Dim type As Object = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF<br />
                wDoc.SaveAs(nme, Type)</p>
<p>                Dim saveChanges As Object = Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges<br />
                For Each doc As Microsoft.Office.Interop.Word.Document In wApp.Documents<br />
                    doc.Save()<br />
                    doc.Close(saveChanges)<br />
                Next<br />
                wApp.Quit(saveChanges)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilpo</title>
		<link>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87235</link>
		<dc:creator>Nilpo</dc:creator>
		<pubDate>Tue, 04 May 2010 17:46:00 +0000</pubDate>
		<guid>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87235</guid>
		<description>Hi Jay,

I don't see where you're using the wdDoNotSaveChanges constant in the example you've provided.  It looks as though you're just using the Quit method without any parameters.</description>
		<content:encoded><![CDATA[<p>Hi Jay,</p>
<p>I don&#8217;t see where you&#8217;re using the wdDoNotSaveChanges constant in the example you&#8217;ve provided.  It looks as though you&#8217;re just using the Quit method without any parameters.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87222</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Tue, 04 May 2010 14:44:49 +0000</pubDate>
		<guid>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-87222</guid>
		<description>Good info!

One thing, when i execute the objWord.Quit wdDoNotSaveChanges, i'm getting a prompt for Save As...any idea why that would be prompting me to do a Save As?

I'm running this from ASP.Net, would that make a difference?

nme = path.Substring(path.LastIndexOf("\") + 1)
                nme = nme.Substring(0, nme.LastIndexOf(".")) + ".rtf"
                wApp.Visible = False
                wDoc = wApp.Documents.Open(path, , False)
                wDoc.Activate()

                nme = path.Substring(0, path.LastIndexOf("\") + 1) + nme
                Dim type As Object = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF
                wDoc.SaveAs(nme, type)
                Dim saveChanges As Object = Microsoft.Office.Interop.Word.WdSaveOptions.wdSaveChanges
                wDoc.Close(saveChanges)
                wApp.Quit()

Thanks for your consideration.</description>
		<content:encoded><![CDATA[<p>Good info!</p>
<p>One thing, when i execute the objWord.Quit wdDoNotSaveChanges, i&#8217;m getting a prompt for Save As&#8230;any idea why that would be prompting me to do a Save As?</p>
<p>I&#8217;m running this from ASP.Net, would that make a difference?</p>
<p>nme = path.Substring(path.LastIndexOf(&#8221;\&#8221;) + 1)<br />
                nme = nme.Substring(0, nme.LastIndexOf(&#8221;.&#8221;)) + &#8220;.rtf&#8221;<br />
                wApp.Visible = False<br />
                wDoc = wApp.Documents.Open(path, , False)<br />
                wDoc.Activate()</p>
<p>                nme = path.Substring(0, path.LastIndexOf(&#8221;\&#8221;) + 1) + nme<br />
                Dim type As Object = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF<br />
                wDoc.SaveAs(nme, type)<br />
                Dim saveChanges As Object = Microsoft.Office.Interop.Word.WdSaveOptions.wdSaveChanges<br />
                wDoc.Close(saveChanges)<br />
                wApp.Quit()</p>
<p>Thanks for your consideration.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilpo</title>
		<link>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-81501</link>
		<dc:creator>Nilpo</dc:creator>
		<pubDate>Wed, 17 Mar 2010 17:46:36 +0000</pubDate>
		<guid>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-81501</guid>
		<description>Hi Hugo,

You can click the Subscribe to Posts link in the sidebar (http://www.nilpo.com/subscribe/) or you can subscribe to the RSS feed (http://www.nilpo.com/feed/).</description>
		<content:encoded><![CDATA[<p>Hi Hugo,</p>
<p>You can click the Subscribe to Posts link in the sidebar (http://www.nilpo.com/subscribe/) or you can subscribe to the RSS feed (http://www.nilpo.com/feed/).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hugo Herrero</title>
		<link>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-81499</link>
		<dc:creator>Hugo Herrero</dc:creator>
		<pubDate>Wed, 17 Mar 2010 17:41:37 +0000</pubDate>
		<guid>http://www.nilpo.com/2008/06/windows-scripting/reading-word-documents-in-wsh/#comment-81499</guid>
		<description>I like the blog, but could not find how to subscribe to receive the updates by email. Can you please let me know?</description>
		<content:encoded><![CDATA[<p>I like the blog, but could not find how to subscribe to receive the updates by email. Can you please let me know?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
