


After encrypting A word document using office extention, it seems like the COM object model becomes unusable. I cannot not manipulate the encrypt document through COM interface, nor can I write macro VBScript to do some operation on the docuent.
For example, I create a word Macro with some simple code.
Sub hi() Dim i As Integer i = ThisDocument.Fields.Count MsgBox i End Sub |
If the document is not encrypt, then we will see a msgbox which tells us the number of bookmarks in the current document.
Now, encrypt the word document using the office extention, running the macro code will fail with error code " 80004005" and error message:Method 'Fields' of bject 'ThisDocument' failed.
It is very important for us to manipulate word documents through COM interface in our system, I want to know why the COM interface does not work anymore after the document is encrypted.
Views
Replies
Sign in to like this content
Total Likes
I'm validating but if I remember correctly RM disables macros to ensure the secure integrity of the document.
Views
Replies
Sign in to like this content
Total Likes
I did get a response and it will depend upon what rights are enabled and what macro functions are being utilized. For example Application.MergeDocuments is always disabled. Application.Dialogs is enabled with copy and edit
Views
Replies
Sign in to like this content
Total Likes
I take macro script as an example to demonstrate that word COM object model cannot be used after encripted. Actually you can reproduce the same problem when you manipulate word document through COM interface using any programming language.
For example, you can create a text document with the following VBscript:
_____________________________________________________
set a = createobject("Word.Application")
set doc = a.Documents.Open("E:\temp\test.docx")
msgbox doc.Fields.count
doc.close
a.quit
_______________________________________________________
Save the document with ".vbs" file extention and then run it by double clicking it. it will fail if the document is encrypted using the office extention.
Views
Replies
Sign in to like this content
Total Likes
Are you using single sign on? If not I'm not surprised it isn't working because how would the app authenticate?
Views
Replies
Sign in to like this content
Total Likes
No, I am not using SSO, when opening the document, the office extention will open a dialog promping me to input username and password.
Views
Replies
Sign in to like this content
Total Likes