|
|
Rank: Advanced Member Groups: Member
Joined: 5/14/2009 Posts: 35 Location: UK
|
Apart from changing the file to read only or storing the file in a read only network folder, is there any way to secure a Process Book via code to stop end users tampering? I don't want to disable menus etc, just stop them from saving changes.
Powerpoint has .pps, Excel and Word have built in password security options, but what is possible with Process Books?
.
|
|
|
|
|
OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System. We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ or contact OSIsoft vCampus for more details.
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 617 Location: Cheshire, United Kingdom.
|
Apart from using PI-ActiveView or PI-WebParts with the Graphic web part, you can achieve this in VBA. Providing your VBA is protected from users viewing it (thus changing it) you can use: Code: Private Sub Display_BeforeSave(ByVal bSaveAsUi As Boolean, bCancel As Boolean)
bCancel = True Call MsgBox("Please note this display is protected and cannot be saved.", vbCritical)
End Sub
If you try to "Save" or "Save As" it won't let them save it. Principal Consultant Real-Time Data Management @ Wipro Technologies
|
|
|
Rank: Advanced Member Groups: Member
Joined: 5/14/2009 Posts: 35 Location: UK
|
A lot of people are using Process Book as a viewer and not the design tool it was intended to be. That's just the culture here so we have to adapt to it. Have been messing with that code, but can only get it to lock down each individual display, not the whole book. Little mercies et al  Thanks for the note about viewing VBA, will remember to add that one. Cheers .
|
|
|
Rank: Newbie Groups: Member
Joined: 12/1/2010 Posts: 2 Location: France
|
Hi, I tried to implement the code preventing user from saving the display. Once the VBA code is added I cannot save display (until here it's logical). Now the problem is how do I save my modification in the VBA Editor ... it may be a stupid question but I cannot find any solution by myself ... Thanks in advance. Oliver.
|
|
|
Rank: Member Groups: Member
Joined: 7/19/2010 Posts: 20
|
You could put the part of a code that prohibits saving into an If statement and have a password to save. For example, when someone hits "save" put a prompt up that says "enter password to save." Then their answer matches the string in the VBA code, do nothing, if not, run the two lines of code RJK provided. And don't forget to password protect the VB code as well! Disclaimer: Any code presented by myself might be unconventional because of the lack of formal training. Any corrections are welcome. =)
|
|
|
Rank: Member Groups: Member
Joined: 10/7/2009 Posts: 14
|
You put a break point at the start of the sub (right click > toggle > Break point) at this line: Code:Private Sub Display_BeforeSave(ByVal bSaveAsUi As Boolean, bCancel As Boolean) Then you click save. When the code window comes up, you right click on the 'end sub' line and select 'Set Next Statement' Then press F5 and it's saved!
|
|
|
Rank: Newbie Groups: Member
Joined: 11/3/2011 Posts: 7 Location: México
|
Hi Everyone:
Try this: Private Sub Display_BeforeSave(ByVal bSaveAsUi As Boolean, bCancel As Boolean) Dim yo, MyPos yo = ThisDisplay.Users.Contents MyPos = InStr(1, yo, "User") ' User means who can save it. If MyPos > 0 Then Else bCancel = True 'Call MsgBox("Please note this display is protected and cannot be saved.", vbCritical) ' Put this if you need it or want it. End If End Sub
|
|
|
|
Guest
|