Word 2003 SP1 crashes after inserting OLE Object programmatically

B

Ben

We're experiencing a strange problem after having installed Service Pack 1 on
Word 2003: Word crashes after inserting two OLE objects with VBA and then
converting them from a shape to an inline shape (when run in IE). We first
experienced the problem with an ocx of our own, but the crash also occurs
with other objects.

To reproduce, do the following:
Open a new Word doc, go to the VB editor and insert the following code:

Sub Makro1()

Dim shapeCalendar As Word.Shape
Dim shapeCalendarInline As Word.InlineShape

'Using Calendar as an example here
Set shapeCalendarInline =
Selection.InlineShapes.AddOLEObject(ClassType:="MSCAL.Calendar.7", _
FileName:="", LinkToFile:=False, DisplayAsIcon:=False)
Set shapeCalendar = shapeCalendarInline.ConvertToShape
Set shapeCalendarInline =
Selection.InlineShapes.AddOLEObject(ClassType:="MSCAL.Calendar.7", _
FileName:="", LinkToFile:=False, DisplayAsIcon:=False)
Set shapeCalendar = shapeCalendarInline.ConvertToShape
End Sub

Close the VB editor and add a new taskbar to your document. Pull the new
macro (Normal.NewMacros.Makro1) on your new taskbar.This is so you can
execute the macro from IE. Save the document and close Word.
Now you need to run the document in IE (we're using IE6 SP2 on an XP SP2
machine by the way). Open Internet Explorer and drag your new document from
the Windows Explorer to IE. When IE asks you whether you want to open or save
the doc, click Open. Right-click on the taskbar and select your new taskbar
so it is displayed. Click on the taskbar to run the macro. Word inserts one
calendar and the crashes, offering you to send an error report. I've added
some MsgBoxes, and Word seems to crash in the second ConvertToShape command.

Any solutions or workarounds?

Thanks, Ben
 

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