I have a macro that creates a new 'results' workbook, then uploads data from a csv file, manipulates the data accordingly then saves the new 'results' workbook.
The macro, in the parent workbook, uses an OnTime event to monitor the csv file and see when it has been updated (by monitoring the time modified). Once the csv has been updated the macro runs again, re-creates the results workbook and resaves.
This continues indefinetly as the code returns to the OnTime event after saving the refreshed results workbook.
I have put a button on the results workbook that I would like the user to click when they are finished collecting data (and the csv will no longer be changing).
I have assigned a boolean 'ButtonClick' variable to the button's click event. The result of which I would like to use to end the code which contains the OnTime event (this code is in a module in the parent workbook).
My problem is that the OnTime code is in the parent workbook and the button is in the results workbook.
I have tried declaring the 'ButtonClick' as public in the parent workbook but then it is not giving a 'variable not defined' error when the button is clicked in the results workbook.
Am I not declaring the 'ButtonClick' variable correctly?
I was successful when establishing a Reference in the results workbook to the parent but I had to do this manually. Is there a way to have the code create this reference when the results workbook is created?
Appologies for the long post but I wanted to fully explain the situation and my problem.
Any help or insights would be greatly appreciated.
TIA
Bookmarks