PDA

View Full Version : VBA file save slow problem



Matrixii
12-02-2017, 02:58 PM
So I’m trying to write an application that writes text files very fast. These files are processed by autohotkey after they are written and their order is important.

Windows is writing files out of time sequence order and I’m assuming it’s some sort of write caching issue.

For example if I write 10 separate text files in five seconds they may not actually be written in chronological order to the disk. For example the fifth one might be actually say before the fourth one etc. it’s not consistent. They are not written that way from VBA however it is strictly a Windows OS issue. I’m looking for some ideas on how to combat that.

ranman256
12-04-2017, 10:08 AM
they do save in the order you save them.
workbooks("A").save
workbooks("B").save

workbook B will NOT save until A is finished

Matrixii
12-04-2017, 11:33 AM
they do save in the order you save them.
workbooks("A").save
workbooks("B").save

workbook B will NOT save until A is finished

Thank you. The problem seems to be that I’m trying to sort by date time and fractions of a second are important however the system doesn’t return them when you pull file properties.

My solution was to simply delete the file the instant it’s processed and that seems to make a huge difference.

When overwriting it there would be no perceivable difference to my routine if the change happened within a second of the last change. So if I deletd it I ensure that I’m always getting the new file .