Link to home
Start Free TrialLog in
Avatar of kasperEH
kasperEHFlag for Denmark

asked on

Opening Word document creates unwanted save

I have created a C# project in Visual Studio 2008 that opens Word documents on a file share, reads their properties and copies them to SharePoint.

The problem is that simply opening the Word documents causes a save that changes the "date modified" of the file. We will have the files both places in a transition period, so this is a serious problem.

I have installed Office 2007 on my development server and I have added  the following using statements:
using Microsoft.Office.Core;
using Word = Microsoft.Office.Interop.Word;

I open the Word documents with this code:
Word._Document oDoc = oDocs.Open(ref oFile, 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, ref oMissing);

- and closes them with this:
oDoc.Close(ref wdDoNotSaveChanges, ref oMissing, ref oMissing);




ASKER CERTIFIED SOLUTION
Avatar of dj_alik
dj_alik

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kasperEH

ASKER

Thank you. It works.