Hi,
I'm trying to save a common macro file (single file to edit) that will be used by multiple templated excel workbooks. It needs to be used by other computers and users so I don't think the personal workbook or creating an add-in would work. So, I'm saving the file with a revision number as a .bas file that will be imported by the template workbook when one of the procedures needs to be run.
At this time, I have form control buttons which, when clicked, will check if .bas file is imported/import .bas file if not or if an older version. This works fine. After that, I'm trying to call on the desired procedure (which is in the loaded .bas file) based on the click.
Problem occurs if there is no .bas file already imported. I get a compile error about the procedure not being defined. I assume this is due to the procedure not existing until I import it but it is trying to compile all the potentially used procedures at the start. Is there a way to tell it to ignore that the procedure doesn't exist yet as it will when it gets to the procedure call?
I guess I'm not understanding how VBA run sequence works. I was assuming that it would only "compile" the code when it was needed. I.e. it would compile the button click procedure and the procedure calls inside of this procedure are just links to a section of code that will be compiled when called. This way a procedure's code could be changed during a run if need be (replace with updated module). Does a run of any procedure compile all procedures in a module? So, even if I have an older version of the procedure loaded so the compiler doesn't complain, if I update the code of those procedures during a run it will still run the older "complied" code?
Does this need to be in two separate macro runs (one for updating procedures code and one to actually use that new code)?
Bookmarks