Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Need code to set doc. to read only and vs (Office 2000 Word SR-1)

    Hi,

    How can I make a code in a template when I want to change "Read Only" to "not Read Only" and back to "Read Only" again?

    Thanks in advance!

    Regards
    Bj

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Need code to set doc. to read only and vs (Office 2000 Word SR-1)

    Can you explain this a little bit more? Are you talking about protecting the document contents so the user cannot edit them (for example, in a form), or controlling whether the user can save over the original document?

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Need code to set doc. to read only and vs (Office 2000 Word SR-1)

    I have the following situation:
    A document, created by means of a template I have made, is stored and chekced in into Microsoft SharePoint Portal Server, document handling application. When published in this application the document is given the status "Read Only". In order to release this attribute for a moment I must set the Attribute "Read Only" to "false" for a moment in the code. This to be able to set "ActiveDocument.CustomDocumentProperties("DOCVERSI ON").Value" to a number(string), retreaved from the document handling application and insert this number into tha document by means of another code.

    So I am talking about controling the attribute "Read Only".

    Thanks if you can advice me giving a code for setting this attribute off and on.

    Regards
    Bj

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Need code to set doc. to read only and vs (Office 2000 Word SR-1)

    If you were opening this document from a file server, you would need to change the file attribute before opening the document. Once it is open, it is too late; Word will not let you save over it. I'm not sure how SharePoint works. In our DMS (WORLDOX), as far as I know, it is not possible to programmatically override the security settings (which determine who can revise and who cannot) at the file system level. Is there a documented API for SharePoint?

  5. #5
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Need code to set doc. to read only and vs (Office 2000 Word SR-1)

    Thanks for a quick reply.

    Here is a link to SharePoint Portal Server: http://www.microsoft.com/sharepoint/portalserver.asp

    Well,
    I had hoped that it should be able to change the read Only attribute when opening the file using the procedure: Private Sub Document_Open()
    and putting in a code for changing the attribute to not read onle and back again when getting hold of the version number. Well, as I understand it is not possible.


    Another code I am also anxious to get is:
    When I use the Word function SaveAs, by applying the procedure: Sub FileSaveAs() and insert a code to get hold of the path to the directory where I store the file and the file name.

    I use this code to open the dialog box: Dialogs(wdDialogFileSaveAs).Show
    and when I click OK I would like to get hold of the path and file name of the document(file) I save.
    Is it possible?

    Regards
    Bj

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Need code to set doc. to read only and vs (Office 2000 Word SR-1)

    <hr>Another code I am also anxious to get is:
    When I use the Word function SaveAs, by applying the procedure: Sub FileSaveAs() and insert a code to get hold of the path to the directory where I store the file and the file name.

    I use this code to open the dialog box: Dialogs(wdDialogFileSaveAs).Show
    and when I click OK I would like to get hold of the path and file name of the document(file) I save.
    Is it possible?<hr>
    With this one, since no knowledge of SharePoint Portal is required, I have a better shot at being able to help! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    If you want to know the path AFTER the file is saved, you can find out easily as follows:

    <pre>Dialogs(wdDialogFileSaveAs).Show
    Dim strPath As String
    strPath = ActiveDocument.Path</pre>

    If strPath is blank, then the document has never been saved. However, if strPath is not blank, you can't be sure the user saved it again...

    If you want to know BEFORE the file is saved, or resolve the uncertainty about what the user actually did in the dialog, you can do this:

    <pre>Dim strPath As String
    With Dialogs(wdDialogFileSaveAs)
    If .Display = -1 Then 'OK was clicked
    strPath = Options.DefaultFilePath(wdCurrentFolderPath)
    .Execute
    End If
    End With</pre>

    In this case, if strPath is blank, it means that the user did not save on this go-round with the Save As dialog.

    In another thread, someone reported a problem using .Display in a context in which the user chose to overwrite an existing file. Because Word doesn't display its normal "are you sure?" dialog when .Display/.Execute are substituted for .Show, it apparently behaved strangely. I haven't really tested that.

    Hope this helps.

  7. #7
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Need code to set doc. to read only and vs (Office 2000 Word SR-1)

    Thanks a lot. I will try out this.
    Bj

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •