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
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » 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(“DOCVERSION”).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
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?
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
[indent]
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?
[/indent]With this one, since no knowledge of SharePoint Portal is required, I have a better shot at being able to help!
If you want to know the path AFTER the file is saved, you can find out easily as follows:
Dialogs(wdDialogFileSaveAs).Show Dim strPath As String strPath = ActiveDocument.Path
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:
Dim strPath As String With Dialogs(wdDialogFileSaveAs) If .Display = -1 Then 'OK was clicked strPath = Options.DefaultFilePath(wdCurrentFolderPath) .Execute End If End With
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.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications