I have a cash flow forecaster, that has given me some sort of issue and spottily works for months now. I am by no means the level of VBA programmer as a lot of people on here, so the fact that this thing has bugged me for this long might be an easy fix for folks on here.
What this forecaster does is:
Takes a look at bunch of our excel files, and generates an A/R from it. It also generates an A/P from it. It also takes a look at our shipment schedule, and creates a future A/P from it. As an addition it has an internal tracker of customer's payment history, and adjusts our projected A/R accordingly. Pretty simple task when I write it like that...
After tweaking tweaking tweaking, I have it *almost* working. I am attaching the excerpt, somewhere within which there is a problem.
The excerpt does as follows:
1) First, fetches workbooks from a list of paths
2) Records all names that are going to appear in the A/R
3) Closes each workbook
4) Again opens up each workbook
5) Keeps a track of average days late/early in payments seen in each workbook, and also Records the AR and AP
6) And lastly, it doesn't work
I am fully aware of the inefficiencies of opening/closing the workbooks only to reopen them, but there is reasoning behind that which I won't get into for interest of brevity.
Basically, the problem is that... some workbooks are not closing. They stay open, it feels like xlbook.close is not firing. It is also messing up the AR and AP somehow. The code used for AR and AP is exactly as I have written it in separate, working, modules.
My best guess is the problem lies somewhere in the:
i
I am sure there may be fix that is outside the realm of my simplistic understanding of objects in Excel
Let me know!
Bookmarks