VBA-tools / VBA-Web

VBA-Web: Connect VBA, Excel, Access, and Office for Windows and Mac to web services and the web
http://vba-tools.github.io/VBA-Web/
MIT License
2.01k stars 494 forks source link

Excel dependency with Application.OnTime still exists #373

Closed lolo58200 closed 5 years ago

lolo58200 commented 5 years ago

Hi all,

First of all, I wanted to thank Tim for VBA-tools.

I wanted to share with you an issue I am hitting when checking if timeout works fine with the WebAsyncWrapper. I am using latest version and discovered that Application.OnTime is called from the class module WebAsyncWrapper https://github.com/VBA-tools/VBA-Web/blob/master/src/WebAsyncWrapper.cls#L226 but WebHelpers.OnTimeoutTimerExpired is never executed. I checked on the net and apparently one should not use Application.OnTime inside a class module. I found that instead of being removed https://github.com/VBA-tools/VBA-Web/issues/88 Application.OnTime was moved from a standard module to a class module Could it explain why it used to work but does t anymore?

thks in advance

Laurent

timhall commented 5 years ago

Hi @lolo58200 I moved it from the module to a separate class to make the general VBA-Web supported on all platforms/applications, but WebAsyncWrapper is only supported in Excel. I looked for an alternative to Application.OnTime, but nothing else was a good fit at the time.

I have a test for the timeout behavior and OnTimeoutTimerExpired is being called, so I'm not sure what the error could be for your case. You are correct that OnTime can't call class methods, that's why I moved OnTimeoutTimerExpired to the public module WebHelpers. If you have more information on your case where the timeout isn't being detected, I'm happy to look into it further.