Opening an existing Word Document in Read/Write mode Using VB.NET

I am using VB.NET to open up an exisitng Word document which works fine, the problem that I have is that it is defaulting to opening the document up in read only mode. How can I change that so that the word document opens in read-write mode so that Word can subsequently be used to update and save the document

Thanks

Bill Partridge



Answer this question

Opening an existing Word Document in Read/Write mode Using VB.NET

  • Herk108

    A varible string is built up based upon the user selecting a row in a datagrid.

    I am using Visual Studio.NET 2003.

    pRegistrationNumber = pRegistrationNumber.Substring(0, 4) + pRegistrationNumber.Substring(5, 3).TrimEnd + ".DOC"

    pServiceLoad = pServiceHistoryFolder + pRegistrationNumber '+ ".DOC"

    appWord.Documents.Open(pServiceLoad)

    appWord.Visible = True


  • project2n5e0o1

    Is the file on your disk read only, or is it opened by another user or another instance of Word already

    --
    SvenC


  • RGrizzzz

    Hi Bill,

    good to hear. Please mark my answer as answer.

    --
    SvenC


  • Michael J Brown

    Hi Bill,

    please show as the code you use to open the word document. Also: which version of word and visual studio do you use

    --
    SvenC


  • MarcGBeauchamp

    Hi SvenC,

    Thanks for this. I had copied some Word documents from my Client and I didn't notice that they had a read-only attribute. All workin now thanks/


  • DodgingRain

    Hi Bill,

    the third parameter of Open is a boolean specifing if you want write or readonly access. Try passing False as parameter.

    --
    SvenC


  • Valst

    Hi SvenC,

    I have added the parameter as adivsed but it is still opening the document up in read only mode, code below:

    Any ideas

    appWord.Documents.Open(pServiceLoad, , False)

    appWord.Visible = True


  • Opening an existing Word Document in Read/Write mode Using VB.NET