Learn to fix the runtime error code 2147467259 by reading this tutorial. This error is most commonly associated with Microsoft Access and to an extent Microsoft Excel.
When Does The Runtime Error -2147467259 Occur?
When you open Microsoft Access and a form through Automation and set focus to the form’s custom menu bar, you receive the following Microsoft Visual Basic error message:
Run-time error ‘-2147467259 (80004005)‘:
Method ‘SetFocus’ of object ‘CommandBarPopup’ failed
What Causes The Error?
Fix Runtime Error ‘-2147467259 (80004005)’ – Microsoft Access
The following steps are to be performed by professionals who are able to do code and work with coding terms accordingly. (Skip ahead if you’re not tech savvy)
Method 1: Trap For The Error
Enter a function similar to the following:
Function AutomationTest() On Error GoTo AutomationErr <Automation code goes here> AutomationExit: Exit Function AutomationErr: If Err.Number = -2147467259 Then Resume 'until control is visible. Else <handle any other errors> End If End Function
If you need further help then try using method 2 on the next page!
Method 2: Insert a Time Delay
Set focus by using code behind the form instead of the Automation code. For example, set the form's TimerInterval to 1000 (the value assigned may vary), and then add the following code to the form:
Private Sub Form_Timer() Me.TimerInterval = 0 Application.CommandBars.ActiveMenuBar.Controls(1).SetFocus End Sub
The run-time error that is mentioned in the “Symptoms” section occurs only when you use Automation. The occurrence varies based on whether or not Access is idle after the form opens, but before the Automation code attempts to set focus to a control. Variations in CPU speeds, program timing, and operating systems may cause this behavior to occur on some computers, but not others. Let’s see how to resolve it on the next page.
For Person’s Not Familiar With Coding
If you’re not tech savvy then you can try a simple and straightforward method to resolve the issue.
- Uninstall MS Access and Visual Basic
- Reinstall both of MS Access and Visual Basic
Sometimes this can help resolve the issue and saves you the time of having to go through all the coding. That is the workaround for the error code if it appears in Microsoft Access, now, let’s talk about the error code with regard to Microsoft Excel.
Microsoft Excel Runtime Error
If you encounter the error while using Microsoft Excel then consider the following:
- You have a macro that sets a property of a chart in Microsoft Excel. For example, the macro sets the MaximumScale, MinimumScale, Title, Axis, or Legend property of a chart.
- You protect the worksheet. When you do this, you click to select the Edit objects check box in the Protect Sheet dialog box.
- You run the macro.
In any of the above scenarios you will most likely encounter an error message that looks something like:
Error message 1
Run-time error ‘-2147467259 (80004005)’: Method ‘MaximumScale’ of object ‘Axis’ failed
Error message 2
Run-time error ‘-2147467259 (80004005)’:Automation errorUnspecified error
This happens because the Excel object model for the chart is disabled on a protected worksheet and luckily there is an easy and simple workaround to the issue. In order to work around this problem, unprotect the worksheet to enable the macro to run. You can manually unprotect the worksheet or you can do so by using the Unprotect method in the macro. Thanks for reading: How to Fix Error Code 2147467259 Source 1 Source 2