This is spooky - has anyone had anything like this before? I have a quite large WIP Calc basic macro. I wanted to be able to output some results to a text file, so set up a sub to do just that from a button on a dialog - simple enough. Ran the macro, pressed the button and checked to see if file was there - it was and correct too (for now it just has the word “TEST” in it). Then it struck me - I hadn’t assigned a button event to the macro!! I checked - I hadn’t - it was a new button - no events assigned. Yet the sub had run - the filename was correct - the path was correct and the content was correct. The sub isn’t called from anywhere (it was brand new), unique name, nothing wrong with the syntax - the sub above it in the code ends correctly - so there’s no “run through”. Nothing else runs the sub - except the single button that I WAS going to assign to it, but haven’t yet done. WTF?! Woooooooooo
… and you are certain that you didn’t (by accident) run your macro from Tools - Macros - Run...
to create that file?
I would delete that text file, wait a while to check that it won’t “magically” reappear, then try again. Perhaps you already did that…
Hi Keme, no I am certain I didn’t run it from Tools>…
I should have saved the text file as-is (was), but I needed to get on and after watching the spookiness happen a few times I assigned the button event as it should have been and carried on coding. Weird though.
To run a macro that you are authoring, you don’t need to go Tools->… route. All you need is just clicking Run button (or its shortcut key combination).
Yes, never use the Tools>… route, always the run button and always ensuring the cursor is on the start of the main sub.