The most likely reason is that you have an open form with an active timer event.
What happens is that when editing the code, the code works at some regular interval. Each time another code is executed, the exact-at-time compiler for VBA starts.
Usually, when you write code, this compilation in real time occurs whenever you go from one line of code to another: compilation errors occur, spaces, spaces, etc. are removed.
However, in your case, you have a piece of code that works. Before it can start, the compiler must work. And he does the same thing that he usually does. Most annoyingly, it cuts off the final white space from your line.
The solution is to close the form with the active timer event or set the timer interval to 0 while editing the code.
mwolfe02
source share