At work, we use several Excel macro’s which, among other things, open workbooks in order to copy data to those workbooks. Since a few weeks, these macro’s don’t work anymore. Other macro’s which don’t have to open another workbook run fine. My colleagues don’t have this problem.
I just now realized that I first encountered this problem the day after I installed gpg4win on my PC (I didn’t run any macro’s which open workbooks on the day of installation).
Did anybody ever hear of this? Is it possible that gpg4win is somehow interfering with the ‘open workbook’ part of my macro’s? And if so, can anybody tell me how to solve this?
Thanks in advance for any assistance.
Try launching your macro by stepping throught it (Alt-F8 then Step into button). Hit F8 to execute each step and see what error message you get when it gets to the open workbook line.
If you find that your macro is skipping steps (jumps over a bunch of steps around the open workbook) It is probably and upgraded version of Excel that is causing the issue. You need to add a line with:
right before your Workbooks.Open Filname := FName$ line
I had to do this at some point for a macro that used to work just fine. Don’t remember exactly why or what causes it but the DoEvents worked.
Thanks for your reply.
Strange as it may seem, I’m pretty certain that it actually was gpg4win causing the problem. I uninstalled it last Friday as an ‘ultimate test’ and after the deinstallation was complete, the macro’s worked fine again. And after I re installed it this morning, the problem with the Workbooks.Open command came right back.
But your DoEvents solution works, so thanks a million! You’re a life saver.
I’m glad that worked. I wonder if that is what caused my Macro’s to fail now. Seems strange that gpg4Win would cause that but based on your findings I am inclined to aggree.