BUG: SmartTags collection is empty when the mapped cell does not contain data in Excel 2003 (832120)



The information in this article applies to:

  • Microsoft Office Excel 2003

SYMPTOMS

You can map a Microsoft Office Excel 2003 workbook to an XML schema. When you do this, if a cell that you map to an XML element does not have any data in that cell, the SmartTags collection of that cell will be empty. This problem occurs even if a Smart Document solution is attached to the workbook.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section of this article.

RESOLUTION

To resolve this problem, make sure that the SmartTags collection of the mapped cell has data in it. If the cell has no data in it, add temporary data to the cell. After you access the SmartTags collection, remove the temporary data.

MORE INFORMATION

Steps to Reproduce the Behavior

The following steps use the SimpleSampleVB6 sample that is installed with the Microsoft Office 2003 Smart Document software development kit (SDK). To make sure that the following steps work correctly, you must download the SDK and then install the SDK.

For additional information, visit the following Microsoft Web site:
  1. In the Microsoft Office 2003 Smart Document SDK readme file, follow the instructions in the "Disable XML expansion pack manifest security before running the samples" topic.

    The Dsdk.rtf readme file is in the C:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office 2003 Smart Document SDK\Help folder.
  2. Modify the SimpleSampleVB6 Smart Document as follows:
    1. In Microsoft Windows Explorer, move to the location where the Microsoft Office 2003 Smart Documents SDK was installed.

      By default, this location is C:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office 2003 Smart Document SDK.
    2. Locate the Samples\SimpleSampleVB6 folder. Open the SimpleSample.vbp file by using Microsoft Visual Basic 6.0.
    3. In the ISmartDocument_InvokeControl method, replace this code
      Case 101
          MsgBox "This is an example of a button."
      with the following code:
      Case 101
          Dim oRange As Excel.Range
          Dim count As Integer
          Set oRange = Target
          count = oRange.SmartTags.count
          MsgBox "The number of elements. . . " & count
      	
    4. On the File menu, click Save Project.
    5. On the File menu, click Make SimpleSample.dll to recompile the library.

      If you are prompted to overwrite the existing file, click Yes.
  3. In Windows Explorer, move to the SimpleSampleVB6 folder, and then double-click the SimpleSample.xls file to open it in Excel 2003.
  4. In Sheet1, right-click the A2 cell.
  5. Click Clear Contents to delete the data in the cell.

    If the task pane does not appear, click View, and then click Task Pane.
  6. In the Document Actions task pane, click Test.

    A message indicates that the SmartTags collection is empty.
  7. Use the instructions in the "Resolution" section to modify the code in the Visual Basic 6.0 project file that is mentioned in step 2a.
    1. Replace the code in step 2c with the following code:
      Case 101
          Dim oRange As Excel.Range
          Dim count As Integer
          Set oRange = Target
          If oRange.Value = "" Then
              oRange.Value = "temp"
              count = oRange.SmartTags.count
              oRange.Value = ""
          Else
              count = oRange.SmartTags.count
          End If
          MsgBox "The number of elements . . ." & count
      
    2. Repeat steps 2d through step 6.

      A message indicates that the SmartTags collection contains two elements.

Modification Type:MajorLast Reviewed:12/12/2003
Keywords:kbBug kbOfficeSmartDoc KB832120 kbAudDeveloper