Word 2003: Error 16389: Internal Error

S

Sean McNamara

Hello, the following situation happens and I haven't yet
found a workaround.

I have a VB6 Standard Executable. I have early-bound
references to objects in the Word 2003 Type Library. The
project contains a reference to the "Microsoft Office 11.0
Type Library" as well as "Microsoft Word 11.0 Type
Library".

I have an open Document object with ActiveX controls
stored in InlineShapes. The following reference is valid
at run-time:

Dim WordApp As New Word.Application
'Open a document
---->WordApp.ActiveDocument.InlineShapes.Count

The last line returns a count, like 16. However, the
following reference is invalid at run-time (but valid at
compile time):

WordApp.ActiveDocument.InlineShapes(1).OLEFormat.Object
Throws Error 16389: Internal Error.

If I attempt to refer to this same property from within
Word 2003 VBA, I successfully receive the ActiveX object.
In this case, I'm expecting something out of Microsoft
Forms 2.0, so in my VB6 project (in a Form's class module)
I've declared

Private WithEvents z As MSForms.CommandButton

'in anticipation of calling

Set z = Wordapp.ActiveDocument.InlineShapes
(1).OLEFormat.Object 'Throws 16389: Internal Error.

This appears to be a major OLE fallacy and is currently a
showstopper in my Office solution. I have yet to find a
workaround; I've tried launching the DoVerb method on the
OLEFormat object; I've tried selecting it, I've tried
activating it, all the methods return some sort of error,
although certain properties of the OLEFormat object can be
retrieved.

When I tried to convert these to Shape objects, they were
incorrectly converted to Picture-type controls rather than
simply floating CommandButton controls.

It's absolutely critical that I enable an event-trapping
reference to several ActiveX controls using a VB6 project
as the Automation Client. If I were to re-create all of
the InlineShapes as floating command buttons to begin
with, would it work any better? The only reason I use
InlineShapes is because they're easier to format than
drawing-space objects - treating them like characters is
extremely convenient. It would take hours to recreate all
the controls as Shapes (since I can't simply convert them
without them becoming Pictures), so if there's any other
way, please let me know. I vaguely remember dealing with
something along these lines many years ago when I was a
much less skilled programmer and giving up on it
completely. I am sadly disappointed that this has not been
addressed since Office 97/VBE4.0, and I'm running Office
2003/VBE6.0. Please advise.

Regards,
Sean McNamara
 

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