{"id":2599,"date":"2022-08-30T15:26:12","date_gmt":"2022-08-30T15:26:12","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/02\/04\/code-works-in-the-ide-crashes-in-the-exe-with-error-91-object-variable-not-set-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:26:12","modified_gmt":"2022-08-30T15:26:12","slug":"code-works-in-the-ide-crashes-in-the-exe-with-error-91-object-variable-not-set-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/code-works-in-the-ide-crashes-in-the-exe-with-error-91-object-variable-not-set-collection-of-common-programming-errors\/","title":{"rendered":"Code works in the IDE crashes in the exe with error 91 &ldquo;object variable not set&rdquo;-Collection of common programming errors"},"content":{"rendered":"<p>You will need to add msgboxes showing the result of testing which variable are set to NOTHING or write to a text file and run the exe and see what is set to nothing.<\/p>\n<p>It may be as simple as having a wait before the last line. A Wait subroutine looks like this.<\/p>\n<pre><code>Public Sub Wait(T As Double)\n    Dim StartTime As Double\n    StartTime = Timer\n    Do While Abs(Timer - StartTime) &lt; T\n    Loop\nEnd Sub\n<\/code><\/pre>\n<p>I would try a 1\/10 of second and work your way up. i.e Wait .1 If have to wait a second or more then make sure you call DoEvents periodically to keep your application responsive.<\/p>\n<p>The reason for this is that the IDE always uses PCODE so is a touch slower than a EXE complied to EXE. You may want to try compiling to PCODE as well to see if that makes a difference.<\/p>\n<p id=\"rop\"><small>Originally posted 2014-02-04 02:41:45. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>You will need to add msgboxes showing the result of testing which variable are set to NOTHING or write to a text file and run the exe and see what is set to nothing. It may be as simple as having a wait before the last line. A Wait subroutine looks like this. Public Sub [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2599","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2599"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2599\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}