Peter
Tue Feb 26 01:59:43 PST 2008
Agreed.
--
Peter Jamieson
http://tips.pjmsn.me.uk
"Jay Freedman" <jay.freedman@verizon.net> wrote in message
news:uMoYTX9dIHA.4396@TK2MSFTNGP02.phx.gbl...
>I think you're correct, but the MS help (and MSDN) don't qualify the
>ClassType values that way. If you go to the topic on AddOLEControl and then
>follow the link in that topic to the one on OLE Programmatic Identifiers
>(
http://msdn2.microsoft.com/en-us/library/aa200268(office.10).aspx ),
>Excel.Sheet appears to be a valid choice.
>
> Peter Jamieson wrote:
>> FWIW I think the immediate reason is that the Excel.Sheet is not
>> defined to be a "Control" (if you look in the registry for
>> Forms.ComboBox.1 and find the entry for its CLSID, it has a Key
>> called "Control" under it. If you experimentally add one under the
>> CLSID for "Excel.Sheet", restart Word and try again, Word will go to
>> the next stage and fail with a memoory-related message, presumably
>> because the object does not actually implement whatever interfaces it
>> needs to be a "Control".
>>
>> "Jay Freedman" <jay.freedman@verizon.net> wrote in message
>> news:eopur35b2vr35oiooqtda2if28q1ekje2c@4ax.com...
>>> On Fri, 22 Feb 2008 12:32:17 -0800 (PST), melon <elty123@gmail.com>
>>> wrote:
>>>> On Feb 22, 3:27 pm, melon <elty...@gmail.com> wrote:
>>>>> I got an error with this (type mismatch)
>>>>>
>>>>> objWord.ActiveDocument.Bookmarks("Required").Range.InlineShapes.AddOLEControl
>>>>> ClassType:="Excel.Sheet"
>>>>>
>>>>> What cause that?
>>>>
>>>> I don't think the syntax is incorrect, since if I change the
>>>> ClassType to something like "Forms.ComboBox.1" then it works.
>>>
>>> I don't know why that doesn't work -- the documentation says it
>>> should be OK --
>>> but I get the same error.
>>>
>>> Instead of the AddOLEControl method, use the AddOLEObject method
>>> (which is what
>>> I showed in my first response). I found that does work.
>>>
>>> --
>>> Regards,
>>> Jay Freedman
>>> Microsoft Word MVP FAQ:
http://word.mvps.org
>>> Email cannot be acknowledged; please post all follow-ups to the
>>> newsgroup so all may benefit.
>
>