Focus Control

sassriverrat

Well-known Member
Joined
Oct 4, 2018
Messages
655
Good Evening,

I seem to be having a workbook that error's out if I have other, non-vba workbooks open. The workbook initially opens up and hides the workbook itself (a userform shows) as designed. However, when I click a button in the userform, I get "run-time erorr '-2147352565 (8002000b)' Can't move focus ot the control because it is invisible, not enabled, or of a type that does not accept the focus."
I was hoping someone had some insight on this. Here is the code that runs when the button is pressed.

Thanks

Code:
Private Sub CommandButton3_Click()
'On Error GoTo Helper
Dim name As String
name = Sheets("Developer").Range("N4")
TryAgain:
Pass = InputBox("Enter Password", "The Coding Sheets")
If Pass = "" Then Exit Sub
If Pass = CStr(Worksheets("Developer").Range("B23").Value) Then
    Sheets("Developer").Visible = True
    Sheets("Notes").Visible = True
    Sheets("Ports").Visible = True
    Sheets("Developer").Select
    Application.Visible = True
Else
    MsgBox "Password incorrect, Please try again", vbCritical, name
    GoTo TryAgain
End If
Unload Me
'Error Clearing Code
Exit Sub
Helper:
    resp = MsgBox("We're sorry to see you've encountered an error." & vbCrLf & vbCrLf & "To proceed, we recommend you contact the Developer " & _
    "with error codes [1066] and " & "[" & Err.Number & "-" & Err.Description & "]." & vbCrLf & vbCrLf & "To attempt to patch your problem at least " & _
    "temporarily, we recommend you click [Yes] to see help directions. Would you like to continue?", vbYesNoCancel, name)
        If resp = vbYes Then
            Call Error_Handle(sprocname, Err.Number, Err.Description)
        ElseIf resp = vbNo Then
            Exit Sub
        ElseIf resp = vbCancel Then
            Exit Sub
        End If
End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hello Sassriverrat,
I don't know what may be cause error but...
If you have more then one workbook opened simultany
try to refer in code to the right workbook.
 
Upvote 0
How would I go about doing that other than through the name of the workbook itself? The workbook with code referenced above has a dynamic name...meaning it changes depending on use. The Template is one name, the active workbook is another, and the archived is a third (and archived is named based on date and other pertinent information...and all of that changes through code).
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top