Code works in the IDE crashes in the exe with error 91 “object variable not set”-Collection of common programming errors

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 Wait(T As Double)
    Dim StartTime As Double
    StartTime = Timer
    Do While Abs(Timer - StartTime) < T
    Loop
End Sub

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.

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.