I have a very complicated process that involves downloading several files from different shares, combining these files into worksheets, manipulating and calculating related information, and then exporting certain fields (and calculations) as reports to a number of Excel workbooks.
I have this process encoded so that I can click one button, and the whole process will be carried out from end to end. I have a series of text fields that function as โindicatorsโ (red - this part did not pass, green - this part succeeded). As you can imagine, the code for the whole process is HUGE (32 pages when copying to MSWord) and is hard to digest when I have a problem.
I realized that I want to put the code in a table so that it is much more modular and understandable. I set the combo box with the action I want to take and the second combo box with the message / file / object I want to work with (for example, Delete - Table 2, Acquisition - File 1, Export - Report 4). I managed to create an SQL statement to do simple things like del * from tbl_test and execute them from combo boxes without any problems.
I need to know if there is a way to place in the table (fragment) a field of essentially a code fragment, and then execute this vba code when choosing suitable combos.
IE code for 'Acquire - File1' is completely VBA code; it displays a network drive, finds a file, downloads a file, and moves it to a directory.
IE code for "Scrub - tblMain_Part1" is a combination of vba and sql code; it checks for the presence of a file (vba), if it finds it, it deletes part of the main table (sql) and adds the contents of the found file (sql), and then updates the monitor, indicating that it (vba). If the file is not found, it changes the monitor window to red and updates the title of the command button (vba)
I am not a genius with vba, but I keep mine. The thought process I had was that if I could essentially get the code broken into manageable pieces in a table, I could call the smippets code in that order if I want to start the whole process, or I could just re-execute parts of the code as needed, by choosing a combination of actions and a report / file / object.
Any thoughts / ideas are welcome.