Unknown return codes from Automation methods

M

mjoe

I'm getting strange return codes when trying to retrieve
properties from a specific Document. The Document object
is being provided to an automation event, and the errors
only are returned for this one document (which is only stange
in that it contains controls and macros).

The properties I'm trying to read are "Name", "Path", and
"FullName". The call to get Name is returning 0x800adf21, and
the calls for Path and Fullname are returning 0x800a8029.

Is there any way to find out what these return codes mean, or
why I'm getting them only for this one document.

TIA,

-M-
 
W

Wei-Dong Xu [MSFT]

Hi mjoe,

Thank you for posting in MSDN managed newsgroup!

The two return codes are defined internally in VBA module. So far as I know, they means that macro security is set too high for the current
document, so it is prevented from enabling VBA to handle requests being made. For your scenario these requests to call the embedded controls will
fail. I'd suggest you can trust the documents by digitally signing them, or lower Macro security for the time being.

The KB article 317405 introduces the method for us to contorl the macro security. Please go to:
317405 OFFXP: How to Implement Application.AutomationSecurity
http://support.microsoft.com/?id=317405

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

mjoe

Per your suggestion, I reduced macro security to Low. It did not
change the behavior of the problem. Note that these error return codes
only get returned when trying to access the properties (like Name)
from a Visual C++ addin using ATL. I tried the exact same thing from a
VB addin, and it worked like a champ. Unfortunately this is a problem
in a large VC++ addin product, so switching to VB is not an option :(

Also, its odd that if you type anything into the "blank" document or
have another document open at the time you're opening the document
with the Checkbox Button controls in it, everything also works fine.
Its just when Word is trying to replace the initial DocumentN document
with the opened document that the errors are returned.

Also, the errors are not returned when trying to access properties of
the controls -- its properties of the ActiveDocument that fail, during
execution of the DocumentChange event processing.

I've traced the error codes down to getting returned from
GetIDsOfNames() in the ATL library. The parameters look correct for
returning the "Name" property ID, and the interface pointer is the
same as the one which works later in the
execution of the process.

BTW, Is there someplace online, or in the docs, where error codes like
these can be looked up?

-M-
 
W

Wei-Dong Xu [MSFT]

Hi mjoe,

Thank you for posting in MSDN managed newsgroup!

So far as I know, the two errors are defined internally in the word automation component. There is no public error list for the two error messages.

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Wei-Dong Xu [MSFT]

Hi harry,

Thank you for posting in MSDN managed newsgroup!

Could you be so kind to send me one small project with the doc file? I will test this for you then. I have also send one mail to you for this.

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top