Click here to Skip to main content
11,438,007 members (47,438 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
Hi,

I'm creating a word file using File Operation.

Later i'm opening the file, some time i'm getting message like,

.doc is locked for editing by user. see my below code,

Word.Application wdApp = new Word.Application();
object obj = System.Type.Missing;
object docPath = bData.Path;
wdApp.Documents.Open(ref docPath, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj);


So, after doing my changes i'm getting error in the save as method,

wdDoc.SaveAs(ref objDoc, ref obFormat, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing);

I'm getting error like ,

Word cannot complete the save due to a file permission error.

please help me.
Posted 3-Feb-13 20:14pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

These are not issues that can be fixed by code. You need to investigate why the file is locked in case 1, and why you are not allowed to save in a particular directory in case 2.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.150506.1 | Last Updated 4 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100