PDA

View Full Version : Odd file locking behaviour



pip-london
07-16-2013, 07:00 AM
Hello,

I'm using Word 2007 to create a new document, to which I add a new style called tStyle.

Then using the Visual Basic editor I add a module with a single sub-routine to delete the tStyle style.


Sub test()
Application.OrganizerDelete Source:=ActiveDocument.FullName, _
Name:="tStyle", Object:=wdOrganizerObjectStyles
End Sub


Saving the document to my local hard drive and running the macro works fine - the tStyle is successfully removed from my document.

However if I save the document to a network share before running the command, I receive an error: "Test.docx is locked for editing by 'pip-london'".

Please could anyone advise why the behaviour on the fileserver is different from the behaviour on my local drive, and how I can resolve the problem?

Thanks very much,

Philip