Avatar of kasperEH
kasperEH
Flag 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);




C#Microsoft Word.NET Programming

Avatar of undefined
Last Comment
kasperEH

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
dj_alik

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
kasperEH

ASKER
Thank you. It works.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23