Run-time error '2475' when stepping into code

riggsd

Board Regular
Joined
Jan 29, 2003
Messages
143
I've set a variable to the active form name and it works fine when the form is active, however, I'm trying to debug part of the code that doesn't work right and when it gets to where it sets the variable to the active form, it gives a Run-time error '2475' message: You entered an expression that requires a form to be the active window.

This only happens when running the code in the editor (I'm stepping into each line) so the form isn't active, the editor is. How do I get around this so I can debug the rest of the code?

Dim frm as Form

Set frm = Screen.ActiveForm
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
you dont call forms that way. Thats a VB6 method.
in Access, use: docmd.openform "frmMyform"

(even if its already open, it will summon it to the front)
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,424
Members
448,961
Latest member
nzskater

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