1

I had a code, which was running perfectly fine yesterday, but now it stopped working and throwing this error:

enter image description here

I have checked my references, and my activeX box is checked:

enter image description here

I am really stuck. What am I doing wrong? Do I need to update something?

15
  • Not sure why you think this has anything to do specifically with ActiveX?I would suggest declaring the variable, perhaps Dim objMyConn. "Something" changed since yesterday. If you're not sure, compare to your backup copy (hint hint) :-) Commented Jul 14, 2018 at 22:45
  • 4
    Probably that you added Option Explicit at the top of the module... Commented Jul 14, 2018 at 22:51
  • 2
    You'll notice then, that when you insert a new module, it automatically says Option Explicit at the top. My guess is you that pasted existing code into another module today. Anyway, case closed and happy coding. Commented Jul 14, 2018 at 23:16
  • 2
    Option Explicit does not 'messed up the code'. Commented Jul 14, 2018 at 23:23
  • 2
    Perhaps compromise by starting to declare your variables so you don't make matters worse when you have time to start using Option Explicit and other 'best practices'. Commented Jul 14, 2018 at 23:37

1 Answer 1

6

This type of error typically emerges after adding Option Explicit at the top of a module, or after pasting working code without explicitly defined variables into a new module with Option Explicit at the top.

Go to Tools > Options > Editor Tab and see if the checkbox for "Require Variable Declaration" is ticked. This is what Option Explicit does.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.