Prevent macro from running when form is opened for editing

For many of my forms in a Base file, I have macros set up to run when the form is opened or closed (through Tools>Customize>Events). Is there a way to have this only happen when the form is opened for use, as opposed to editing?


Insert at beginning of Sub:

' If Design mode, just exit the routine
	xCurrentController = thisComponent.CurrentController
	If xCurrentController.isFormDesignMode Then
		Exit Sub
	End If

Thanks! That’s very straight-forward. One more question: I generally try to follow the convention of putting a lowercase character at the beginning of my variable name to indicate the type. E.g., sSQL would be a string. Is that what the “x” at the beginning of “xCurrentController” is?

It doesn’t matter what letter you put in front of it.
It’s just a stupid habit to do it.

I realize the compiler/interpreter doesn’t care what I start the names with. It’s just a simple way to help me (or others who might look at it to know the variable type without having to go to where it’s declared. (Kind of like putting comments in the code.)

The code was copied many years ago. Too lazy to change for the post. I agree with @karolus