OFF2000: Error Or Unexpected Results Using SetFocus Method on Commandbar (220684)



The information in this article applies to:

  • Microsoft Excel 2000
  • Microsoft PowerPoint 2000
  • Microsoft Word 2000

This article was previously published under Q220684

SYMPTOMS

If you run a Microsoft Visual Basic for Applications macro that sets the focus of a command bar by using the SetFocus method, you may see the following behavior depending on which program you are using:

PowerPoint 2000

You may receive the following error in Powerpoint 2000:
Run-time error '-2147467259(800004005)':
Method 'SetFocus' of object 'CommandBarControl' failed

Excel 2000 and Word 2000

The command bar may not be selected as expected.

CAUSE

This behavior occurs when you run a Microsoft Visual Basic for Applications macro that sets the focus to a command bar that is disabled, or is not visible. Since the control is disabled or is not visible, the SetFocus method fails.

MORE INFORMATION

In Microsoft Visual Basic for Applications, you cannot set the focus to a command bar that is disabled, or is not visible.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbbug kbnofix KB220684