Microsoft KB Archive/832120

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

Article ID: 832120

Article Last Modified on 12/12/2003

-

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 &quot;Applies to&quot; 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.



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:

http://www.microsoft.com/downloads/details.aspx?FamilyId=24A557F7-EB06-4A2C-8F6C-2767B174126F

 In the Microsoft Office 2003 Smart Document SDK readme file, follow the instructions in the &quot;Disable XML expansion pack manifest security before running the samples&quot; 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. Modify the SimpleSampleVB6 Smart Document as follows:  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. Locate the Samples\SimpleSampleVB6 folder. Open the SimpleSample.vbp file by using Microsoft Visual Basic 6.0.  In the ISmartDocument_InvokeControl method, replace this code Case 101 MsgBox &quot;This is an example of a button.&quot; with the following code:

Case 101 Dim oRange As Excel.Range Dim count As Integer Set oRange = Target count = oRange.SmartTags.count MsgBox &quot;The number of elements. . . &quot; & count  On the File menu, click Save Project.</li> On the File menu, click Make SimpleSample.dll to recompile the library.

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

If the task pane does not appear, click View, and then click Task Pane.</li> In the Document Actions task pane, click Test.

A message indicates that the SmartTags collection is empty.</li> Use the instructions in the &quot;Resolution&quot; section to modify the code in the Visual Basic 6.0 project file that is mentioned in step 2a. <ol style="list-style-type: lower-alpha;">  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 = &quot;&quot; Then oRange.Value = &quot;temp&quot; count = oRange.SmartTags.count oRange.Value = &quot;&quot; Else count = oRange.SmartTags.count End If   MsgBox &quot;The number of elements. . .&quot; & count </li> Repeat steps 2d through step 6.

A message indicates that the SmartTags collection contains two elements.</li></ol> </li></ol>

Keywords: kbbug kbofficesmartdoc KB832120

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.