Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Unexpected behavior when you use OLE objects in the Document Actions task pane for a Smart Document solution in Microsoft Office Excel or in Microsoft Office Word


View products that this article applies to.


Important This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:
256986 (http://support.microsoft.com/kb/256986/ ) Description of the Microsoft Windows Registry

↑ Back to the top


Symptoms

If you try to use an OLE object as an ActiveX control in the Document Actions task pane for a Smart Document solution, you may experience unexpected behavior.

↑ Back to the top


Cause

This behavior occurs because the use of OLE objects in the Document Actions task pane is not supported. Examples of OLE objects include embedded Microsoft Office Excel 2007 or Microsoft Office Excel 2003 worksheets, embedded Microsoft Office Word 2007 or Microsoft Office Word 2003 documents, and Microsoft Graph charts.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


Resolution

To include functionality that is provided by an OLE object in the Document Actions task pane, use a type of control that provides similar functionality, such as an ActiveX control or a native control.

Following are two examples of how you can use an ActiveX control instead of using the embedding technique:
  • To add charting functionality to your Smart Document, use an ActiveX control from the Microsoft Office Web Component chart, instead of embedding a Graph chart.
  • To add spreadsheet functionality to your Smart Document, use an ActiveX control from the Microsoft Office Web Component spreadsheet, instead of embedding an Excel 2007 or Excel 200 worksheet.

↑ Back to the top


More information

Warning If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

Steps to reproduce the problem

Note The following steps use information and files that are installed with the Microsoft Office 2003 Smart Document software development kit (SDK). The following steps work correctly only when the SDK is installed. To download and to install the SDK, visit the following Microsoft Web site:
  1. To create the Smart Document DLL, follow these steps:
    1. Start Microsoft Visual Basic 6.0.
    2. On the File menu, click New Project.
    3. In the New Project dialog box, click ActiveX DLL, and then click OK.
    4. Type SDGraph for the Project Name.
    5. In the Class Module window, add the following code:
      Implements ISmartDocument
      
      'CONSTANTS
      'You must have one constant for the schema namespace, one constant for each
      'schema element that you want to provide smart document controls for
      'and actions for, and one constant for the total number of schema elements
      'that have associated actions.
      
      'Because XML is case sensitive, the values
      'of these constants must be exact both in spelling and in case.
      'Therefore, if the textBox element is spelled with a
      'capital B in the XML schema, you must assign the
      'value of the cTEXTBOX constant as "cNAMESPACE & #textBox".
      
      'Namespace constant
      Const cNAMESPACE As String = "urn:schemas-xml-office:SDGraph"
      
      'Element constants
      Const cActiveX As String = cNAMESPACE & "#SDActiveX"
      
      'Number of types (or element constants)
      Const cTYPES As Integer = 1
      
      'Constants
      Private strPath  As String
      Private strApp As String
      
      Private Sub ISmartDocument_SmartDocInitialize(ByVal ApplicationName As String, ByVal Document As Object, ByVal SolutionPath As String, ByVal SolutionRegKeyRoot As String)
      
          strPath = Document.Path & "\"
          strApp = Document.Application.Name
      
      End Sub
      
      Private Property Get ISmartDocument_SmartDocXmlTypeCount() As Long
          
          ISmartDocument_SmartDocXmlTypeCount = cTYPES
          
      End Property
      
      Private Property Get ISmartDocument_SmartDocXmlTypeName( _
              ByVal XMLTypeID As Long) As String
      
          Select Case XMLTypeID
              Case 1
                    ISmartDocument_SmartDocXmlTypeName = cActiveX
              Case Else
      
          End Select
          
      End Property
      
      Private Property Get ISmartDocument_SmartDocXmlTypeCaption( _
              ByVal XMLTypeID As Long, ByVal LocaleID As Long) As String
                      
          Select Case XMLTypeID
              Case 1
                 ISmartDocument_SmartDocXmlTypeCaption = "Microsoft Graph"
          Case Else
          End Select
          
      End Property
      
      Private Property Get ISmartDocument_ControlCount( _
              ByVal XMLTypeName As String) As Long
                      
          Select Case XMLTypeName
              Case cActiveX
                  ISmartDocument_ControlCount = 1
              Case Else
              
          End Select
          
      End Property
      
      'The ControlID for the first control that you add is 1.
      'For more information about how to specify the ControlID, see the ControlID reference
      'topic in the References section of this SDK.
      Private Property Get ISmartDocument_ControlID( _
              ByVal XMLTypeName As String, _
              ByVal ControlIndex As Long) As Long
          
          Select Case XMLTypeName
              Case cActiveX
                  ISmartDocument_ControlID = ControlIndex
              Case Else
                  
          End Select
          
      End Property
      
      Private Property Get ISmartDocument_ControlNameFromID( _
              ByVal ControlID As Long) As String
          
      'This subroutine is intentionally left empty.
      End Property
      
      Private Property Get ISmartDocument_ControlCaptionFromID( _
              ByVal ControlID As Long, ByVal ApplicationName As String, _
              ByVal LocaleID As Long, ByVal Text As String, _
              ByVal Xml As String, ByVal Target As Object) As String
              
          Select Case ControlID
              Case 1
                 ISmartDocument_ControlCaptionFromID = "Microsoft Graph"
                 ISmartDocument_ControlCaptionFromID = "{00020803-0000-0000-C000-000000000046}"  ' MSGraph.Chart
                 'ISmartDocument_ControlCaptionFromID = "{0002E55D-0000-0000-C000-000000000046}"  'OWC11 Chart
              Case Else
              
          End Select
          
      End Property
      
      Private Property Get ISmartDocument_ControlTypeFromID( _
              ByVal ControlID As Long, _
              ByVal ApplicationName As String, _
              ByVal LocaleID As Long) As SmartTagLib.C_TYPE
      
          Select Case ControlID
              Case 1
                  ISmartDocument_ControlTypeFromID = C_TYPE_ACTIVEX
              Case Else
              
          End Select
          
      End Property
      
      Private Sub ISmartDocument_PopulateActiveXProps(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, ByVal ActiveXPropBag As SmartTagLib.ISmartDocProperties)
         Dim ControlIndex As Integer
         
         ControlIndex = 0
         
         If ControlID = 1 Then
              Select Case ControlIndex
                  Case 0
                      Props.Write "X", "5"
                      Props.Write "Y", "0"
                      Props.Write "H", "180"
                      Props.Write "W", "180"
              End Select
          End If
      End Sub
      
      Private Sub ISmartDocument_PopulateCheckbox(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, Checked As Boolean)
      
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_PopulateDocumentFragment(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, DocumentFragment As String)
      
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_PopulateHelpContent(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, Content As String)
      
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_PopulateImage(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, ImageSrc As String)
      
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_PopulateListOrComboContent(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, List() As String, count As Long, InitialSelected As Long)
          
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_PopulateOther(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties)
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_PopulateRadioGroup(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties, List() As String, count As Long, InitialSelected As Long)
          
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_PopulateTextboxContent( _
              ByVal ControlID As Long, ByVal ApplicationName As String, _
              ByVal LocaleID As Long, ByVal Text As String, _
              ByVal Xml As String, ByVal Target As Object, _
              ByVal Props As SmartTagLib.ISmartDocProperties, Value As String)
      
          'This subroutine is intentionally left empty.
      
      End Sub
      
      Private Sub ISmartDocument_ImageClick(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal Target As Object, ByVal Text As String, ByVal Xml As String, ByVal LocaleID As Long, ByVal XCoordinate As Long, ByVal YCoordinate As Long)
      
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_InvokeControl(ByVal ControlID As Long, ByVal ApplicationName As String, ByVal Target As Object, ByVal Text As String, ByVal Xml As String, ByVal LocaleID As Long)
      
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_OnCheckboxChange(ByVal ControlID As Long, ByVal Target As Object, ByVal Checked As Boolean)
      
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_OnListOrComboSelectChange(ByVal ControlID As Long, ByVal Target As Object, ByVal Selected As Long, ByVal Value As String)
      
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_OnRadioGroupSelectChange(ByVal ControlID As Long, ByVal Target As Object, ByVal Selected As Long, ByVal Value As String)
      
      'This subroutine is intentionally left empty.
      End Sub
      
      'After you enter something in the text box,
      'the SimpleSample smart document displays a message that says "Hello".
      Private Sub ISmartDocument_OnTextboxContentChange( _
              ByVal ControlID As Long, ByVal Target As Object, _
              ByVal Value As String)
                      
      'This subroutine is intentionally left empty.
      End Sub
      
      Private Sub ISmartDocument_OnPaneUpdateComplete(ByVal Document As Object)
      
      'This subroutine is intentionally left empty.
      End Sub
    6. On the Project menu, click References, select Microsoft Word 11.0 Object Library or Microsoft Word 12.0 Object Library, select Microsoft Smart Tags 2.0 Type Library, and then click OK.
    7. On the File menu, select Make SDGraph.dll to build the Smart Document DLL.
  2. To create the manifest file, follow these steps:
    1. Open a text editor such as Notepad. Paste the following code in a blank document:
      <?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <manifest xmlns="http://schemas.microsoft.com/office/xmlexpansionpacks/2003">
      	<uri>urn:schemas-xml-office:SDGraph</uri>
      	<version>1.0</version>
      	<location>SDGraphManifest.xml</location>
      	<updateFrequency>10000</updateFrequency>
      	<solution>
      		<solutionID>SDGraph</solutionID>
      		<alias>SDGraph Schema</alias>
      		<type>schema</type>
      		<file>
      			<type>schema</type>
      			<version>1.0</version>
      			<filePath>SDGraph.xsd</filePath>
      		</file>
      	</solution>
      	<solution>
      		<solutionID>SDGraph</solutionID>
      		<alias>SDGraph Solution 02</alias>
      		<type>SmartDocument</type>
      		<file>
      			<type>SolutionActionHandler</type>
      			<version>1.0</version>
      			<filePath>SDGraph.dll</filePath>
      			<CLSID><Enter CLSID of Smart Document dll></CLSID>
      			<regsvr32/>
      		</file>
      	</solution>
      </manifest>
    2. Start Regedit.exe.
    3. Expand the HKEY_CLASSES_ROOT hive, and then locate the SDGraph.Class1 key.
    4. Expand the SDGraph.Class1 key, and then select the CLSID subkey.
    5. Copy the GUID for the CLSID. Replace the occurrence of <Enter CLSID of Smart Document dll> in the code with the GUID of the DLL.
    6. Save the file as SDGraphManifest.xml, and then close the file.
  3. To create the schema file, follow these steps:
    1. Open a text editor such as Notepad. Paste the following code in a blank document:
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns="urn:schemas-xml-office:SDGraph"
      targetNamespace="urn:schemas-xml-office:SDGraph"
      elementFormDefault="qualified"
      attributeFormDefault="qualified">
      
      <xsd:complexType name="SDGraph">
      	<xsd:all>
      		<xsd:element name="SDActiveX" type="xsd:string"/>
      	</xsd:all>
      </xsd:complexType>
      <xsd:element name="SDGraph" type="SDGraph"/>
      </xsd:schema>
      
    2. Save the file as SDGraph.xsd, and then close the file.
  4. To test the Smart Document, follow these steps:
    1. The DisableManifestSecurityCheck.reg file is installed by the Office 2003 Smart Document SDK. To add the registry key that disables the manifest security check, locate, and then double-click the key.
    2. Start Word.
    3. Word 2007
      On the Developer tab, click Expansion Pack, and then click Add

      Word 2003
      On the Tools menu, click Templates and Add-ins.
    4. In the Templates and Add-ins dialog box, click the XML Expansion Packs tab, and then click Add.
    5. In the Install XML Expansion Pack dialog box, locate the SDGraphManifest.xml file. Select the SDGraphManifest.xml file, and then click Open.

      Note If you receive a prompt to re-enable XML expansion pack security, click No.
    6. Click OK to close the Templates and Add-ins dialog box after the installation is completed.
    7. Word 2007
      On the Developer tab, click Structure.

      Word 2003Click the Document Actions task pane title, and then click XML Structure.
    8. Make sure that the Show XML tags in the smart document check box is selected.
    9. Add the SDGraph element and the SDActiveX element to the document.
    10. Click the XML Structure task pane title, and then click Document Actions. Double-click the SDActiveX element in the document to start Graph.

      An exception occurs.

↑ Back to the top


Keywords: KB832118, kbofficesmartdoc, kbprb

↑ Back to the top

Article Info
Article ID : 832118
Revision : 4
Created on : 3/30/2007
Published on : 3/30/2007
Exists online : False
Views : 491