Hi,
I have produced some VBA code which opens EViews, updates some data series in the workfile, forecasts an equation and then copies the outputs into Excel. Unfortunately, I keep getting the following error in VBA:
"Run-time error '-2147467259 (80004005)':
EViews is currently busy"
Do you know of a way I can stop this error message appearing please? Sometimes the code will run through without a problem, but other times this error message will appear.
Any help would be greatly appreciated.
Thanks.
EViews is currently busy VBA error
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Steve
- EViews Developer
- Posts: 844
- Joined: Tue Sep 16, 2008 3:00 pm
- Location: Irvine, CA
Re: EViews is currently busy VBA error
POSSIBLE VBA CAUSES
EViews itself is not designed to support multiple users at once. It's still a single user application, even if you use COM Automation to control it. Because of that, if you use EViews directly using it's normal GUI interface and tell it to run a long running process (or a program), it will be "busy" until that finishes. If a COM client (such as VBA) tries to use that instance of EViews at the same time, it will get that "busy" error until the long running process completes.
A simple solution is for a COM client to use it's own instance of EViews (you can ask for this in the EViewsMgr.GetApplication call). This will insure that no one else will use that copy of EViews while that particular COM client needs it. Of course this will take more memory to run but at least you won't get a "busy" error.
Another thing to watch out for is that VBA is multi-threaded -- meaning it can run multiple VBA methods at the same time if the user asks for it. For example, if you have a VBA button on an Excel spreadsheet that performs some work with EViews and this operation could take a long time, the spreadsheet user may not see any activity for a while after clicking it once. Since they don't see a response quickly, they might click the button again. At this point, VBA will start another process and run the same button method a second time. If they both share the same instance of EViews, you will most likely get the "busy" error for this second process since EViews is "busy" with the activity for the first process. You can avoid this by disabling the button while it's click method is running, then re-enabling it after it is complete.
POSSIBLE EVIEWS CAUSES
If you're sure that you only have a single process running and you're still get a "busy" error, then there might be a bug in EViews. To check for this, right after you get the new instance of EViews in your VBA code, call the Application.Show() method so that EViews becomes visible. Now run your VBA program normally. When the VBA program get's a "busy" error, switch over to EViews to see if an EViews dialog is being displayed and is waiting for it to close. If it is, that is a bug on our part. Dialogs should not be displayed when EViews is running code from a VBA COM client so we'd have to fix that. Please send me a screenshot of the dialog and what COM client command was called that caused it.
Steve
EViews itself is not designed to support multiple users at once. It's still a single user application, even if you use COM Automation to control it. Because of that, if you use EViews directly using it's normal GUI interface and tell it to run a long running process (or a program), it will be "busy" until that finishes. If a COM client (such as VBA) tries to use that instance of EViews at the same time, it will get that "busy" error until the long running process completes.
A simple solution is for a COM client to use it's own instance of EViews (you can ask for this in the EViewsMgr.GetApplication call). This will insure that no one else will use that copy of EViews while that particular COM client needs it. Of course this will take more memory to run but at least you won't get a "busy" error.
Another thing to watch out for is that VBA is multi-threaded -- meaning it can run multiple VBA methods at the same time if the user asks for it. For example, if you have a VBA button on an Excel spreadsheet that performs some work with EViews and this operation could take a long time, the spreadsheet user may not see any activity for a while after clicking it once. Since they don't see a response quickly, they might click the button again. At this point, VBA will start another process and run the same button method a second time. If they both share the same instance of EViews, you will most likely get the "busy" error for this second process since EViews is "busy" with the activity for the first process. You can avoid this by disabling the button while it's click method is running, then re-enabling it after it is complete.
POSSIBLE EVIEWS CAUSES
If you're sure that you only have a single process running and you're still get a "busy" error, then there might be a bug in EViews. To check for this, right after you get the new instance of EViews in your VBA code, call the Application.Show() method so that EViews becomes visible. Now run your VBA program normally. When the VBA program get's a "busy" error, switch over to EViews to see if an EViews dialog is being displayed and is waiting for it to close. If it is, that is a bug on our part. Dialogs should not be displayed when EViews is running code from a VBA COM client so we'd have to fix that. Please send me a screenshot of the dialog and what COM client command was called that caused it.
Steve
Who is online
Users browsing this forum: No registered users and 2 guests
