|
Word: VBA ограничение доступа | ☑ | ||
---|---|---|---|---|
0
dk
06.02.13
✎
15:30
|
исходные:
есть шаблон в ворде с закладками и полями ввода задача: нужно заполнить закладки в шаблоне данными, и установить ограничение доступа только на заполнение полей ввода проблема: макросы не записываются когда я устанавливаю ограничение доступа Нужен пример кода, где устанавливается ограничение доступа в Word 2010 |
|||
1
dk
06.02.13
✎
15:47
|
ну а вдруг
|
|||
2
dk
07.02.13
✎
07:47
|
однако
|
|||
3
manyak
07.02.13
✎
08:12
|
Permission Object
The Permission property of the Document object in Microsoft Office Word 2003 or Microsoft Office Word 2007, a Workbook object in Microsoft Office Excel 2003 or Microsoft Office Excel 2007, and a Presentation object in Microsoft Office PowerPoint 2003 or Microsoft Office PowerPoint 2007 returns a Permission object. Remarks Use the Permission object to restrict permissions to the active document and to return or set specific permissions settings. The Permission object gives access to a collection of UserPermission objects. Use the UserPermission object to associate specific sets of rights with individual users. While some permissions granted through the user interface (such as msoPermissionPrint) apply to all users, you can use the UserPermission object to assign them on a per-user basis with per-user expiration dates. Microsoft Office Information Rights Management supports the use of administrative permission policies which list users and groups and their document permissions. Use the ApplyPolicy method to apply a permission policy, and the PermissionFromPolicy, PolicyName, and PolicyDescription properties to return policy information. The Permission object model is available whether permissions are restricted on the active document or not . The Permission property of the Document, Workbook, and Presentation objects does not return Nothing when the active document does not have restricted permissions. Use the Enabled property to determine whether a document has restricted permissions. Use of the Permission object raises an error when the Windows Rights Management client is not installed. Example The following example returns information about the permissions settings on the active document. Visual Basic for Applications Dim irmPermission As Office.Permission Dim strIRMInfo As String Set irmPermission = ActiveWorkbook.Permission If irmPermission.Enabled Then strIRMInfo = "Permissions are restricted on this document." & vbCrLf strIRMInfo = strIRMInfo & " View in trusted browser: " & _ irmPermission.EnableTrustedBrowser & vbCrLf & _ " Document author: " & irmPermission.DocumentAuthor & vbCrLf & _ " Users with permissions: " & irmPermission.Count & vbCrLf & _ " Cache licenses: " & irmPermission.StoreLicenses & vbCrLf & _ " Request permission URL: " & irmPermission.RequestPermissionURL & vbCrLf If irmPermission.PermissionFromPolicy Then strIRMInfo = strIRMInfo & " Permissions applied from policy:" & vbCrLf & _ " Policy name: " & irmPermission.PolicyName & vbCrLf & _ " Policy description: " & irmPermission.PolicyDescription Else strIRMInfo = strIRMInfo & " Default permissions applied." & vbCrLf & _ " Default policy name: " & irmPermission.PolicyName & vbCrLf & _ " Default policy description: " & irmPermission.PolicyDescription End If Else strIRMInfo = "Permissions are NOT restricted on this document." End If MsgBox strIRMInfo, vbInformation + vbOKOnly, "IRM Information" Set irmPermission = Nothing |
|||
4
dk
07.02.13
✎
08:21
|
(3) не, по примеру вроде не то
--- пока некогда, но вроде нашел то что нужно Protect(wdAllowOnlyFormFields) и SetPasswordEncryptionOptions() |
|||
5
dk
07.02.13
✎
12:17
|
итого
SetPasswordEncryptionOptions() - мимо помогло Док.Protect(2, -1, "сацйпйкпйукпй43е234"); --- но защита получилась тупая - тупо пересохраняешь в doc и спокойно меняешь, что хочешь |
|||
6
dk
07.02.13
✎
14:43
|
продолжу бложик:
наглый open office 3 плевать хотел на метод protect пробую вариант protect + saveas2 (WritePassword) |
|||
7
dk
07.02.13
✎
16:12
|
победил таки open office
т.е. пришлось откатиться на формат Word 97 и использовать старые поля ввода вместо новых 2007-х |
Форум | Правила | Описание | Объявления | Секции | Поиск | Книга знаний | Вики-миста |