BUG: Type Mismatch Error When Calling ShowBrowserBar Without Optional Parameter (251135)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 4.0
  • Microsoft Internet Explorer (Programming) 4.01
  • Microsoft Internet Explorer (Programming) 4.01 SP1
  • Microsoft Internet Explorer (Programming) 4.01 SP2
  • Microsoft Internet Explorer (Programming) 5
  • Microsoft Internet Explorer (Programming) 5.01
  • Microsoft Internet Explorer (Programming) 5.5
  • Microsoft Visual Basic Learning Edition for Windows 5.0
  • Microsoft Visual Basic Learning Edition for Windows 6.0
  • Microsoft Visual Basic Professional Edition for Windows 5.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 5.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0

This article was previously published under Q251135

SYMPTOMS

Calling the InternetExplorer object's ShowBrowserBar method without the optional second parameter (pvarShow) produces the following error message:
Run-time Error '13':
Type Mismatch
The same error occurs if Null (or 0 or vbNull or vbNullString) is used for the second parameter.

CAUSE

ShowBrowserBar does not check for the variant types VT_ERROR and VT_NULL (passed by a missing parameter and the Visual Basic keyword Null, respectively) when determining the validity of the pvarShow parameter.

RESOLUTION

The second parameter must be present and must be declared as a variant having one of three values: true, false, or empty (an uninitialized variant). Note that passing empty has the same effect as passing true, since the default action is to show the bar.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start a new Standard EXE project in Visual Basic. Form1 is created by default.
  2. Add a reference to the Microsoft Internet Controls (Shdocvw.dll) using References on the Project menu.
  3. Copy the following code into the Code window of Form1:
    Dim WithEvents g_ieAuto As InternetExplorer
    
    Private Sub Form_Load()
       Set g_ieAuto = New InternetExplorer
       g_ieAuto.Visible = True
       g_ieAuto.Navigate2 "http://msdn.microsoft.com/workshop"
    End Sub
    
    Private Sub g_ieAuto_DocumentComplete(ByVal pDisp As Object, URL As Variant)
       g_ieAuto.ShowBrowserBar "{30D02401-6A81-11D0-8274-00C04FD5AE38}"
    End Sub
    					
  4. On the Run menu, click Start or press the F5 key to start the program. The error message will appear.
  5. Change the call to ShowBrowserBar to the following:
       g_ieAuto.ShowBrowserBar "{30D02401-6A81-11D0-8274-00C04FD5AE38}", Empty
    					
  6. On the Run menu, click Start, or press the F5 key to start the program. The error message does not appear and the Search bar is displayed.

REFERENCES

For additional information, please see the following MSDN Web Workshop site:

Modification Type:MajorLast Reviewed:5/12/2003
Keywords:kbBug kbpending KB251135