Forum Discussion
Macro's in Excel from Microsoft 365 EXTREMELY SLOW
Step 1: I did a repair but that didn't make any difference...
Step 2: I removed and re-installed O365 (standard 64bit) but that didn't make any difference
Step 3: I removed and re-installed O365 32 bit but that didn't make any difference
Any more suggestions?
- René MeijersJan 26, 2023Copper Contributor
After your reply I noticed something strange.
When I hit the 'create pdf' button on my userform it takes 38 seconds to finish creating the document and finish the macro'. But When I hit the 'create pdf' button and switch (alt-tab) to the folder in my explorer (and the macro runs in the background) it only takes 13 seconds to finish creating the pdf and finish the macro.... How is that possible?!
And this only happens in O365. In O2016 it works like a charm.
The screenupdating = false still doesn't work well in all routines. In some routines it works well but in others it doesn't. And this only happens in O365- ecovonreinJan 26, 2023Iron Contributor
I do not know the answer but our suspicion must surely be that the two problems are related. Perhaps your "create pdf" button performs an operation that is fast when the screen does not require updating but slow when it does? I really cannot understand how screenupdating=FALSE cannot "work well" - it either works or it doesn't. There is no room for it working badly.
From poor memory, SceenUpdating is not scoped, ie will not reset to TRUE on its own accord. The error in VBA more often than not is to fail to reinstate ScreenUpdating. That said, I cannot recall how Excel deals with a VBA macro exiting while ScreenUpdate remains stuck at FALSE. Surely, Excel cannot tolerate such an exit.So my suspicion might be that your macro is somehow transitioning between in-macro and out-of-macro state, implicitly setting ScreenUpdating=TRUE whenever transitioning out-of-macro and failing to reinstate ScreenUpdating=FALSE because you do not recognize the transition back to in-macro.
That might explain your language "not well".Are you using Excel's built-in PDF creator? I would focus my attention at that PDF creator. It seems to interact with your Excel in an unhealthy fashion, differently on O365 than your other version.
Once more, I would comment out the one-line call to the delegated PDF creation to localize the problem. If performance improves, and if the problems with ScreenUpdating somehow go away, you know that both problems relate to that delegation. (The actual PDF creation is unlikely of any relevance to the rest of your code.)
- René MeijersJan 29, 2023Copper ContributorYes I use the built-in PDF creator from excel