Unfortunate glitch using wfopen to read Excel files

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

gabrielehrlich
Posts: 6
Joined: Thu Apr 14, 2016 1:07 pm

Unfortunate glitch using wfopen to read Excel files

Postby gabrielehrlich » Wed May 04, 2016 10:38 am

My group has been experiencing an unfortunate glitch using wfopen to read data from Excel 2010 files. If we have an Excel workbook open and we simultaneously use wfopen to read the data in it into Eviews, Excel no longer prompts us to save when we close the Excel workbook (even if we have made changes). Annoyingly, Excel no longer prompts us to save when we close any other workbooks we had open either. We have to exit Excel completely for the save prompt to come back. Here is an example of some code that causes problems:

Code: Select all

%targetsfile = %pathname + "targets.xlsx" wfopen(wf=targets) %targetsfile range=sheet1 'Now try making a change in the targets.xlsx file and closing it - Excel should not prompt you to save 'Also try making a change to any other workbook you have open simultaneously and closing that - Excel should also not prompt you to save
Have other people had this issue? (We did not find this exact issue on the forum.) If not, we would like to make EViews aware of it. Thanks!

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: Unfortunate glitch using wfopen to read Excel files

Postby EViews Jason » Wed May 04, 2016 2:07 pm

We are not seeing the problem described in your text. What version of EViews and Excel are you using?

If you change the excel file, regardless if you use wfopen, Excel always asks to save.

NOTE: In your example, you said

Code: Select all

'Now try making a change in the targets.xlsx file and closing it - Excel should not prompt you to save
This is contradictory to your original statement. Excel should prompt in this case.

gabrielehrlich
Posts: 6
Joined: Thu Apr 14, 2016 1:07 pm

Re: Unfortunate glitch using wfopen to read Excel files

Postby gabrielehrlich » Wed May 04, 2016 5:33 pm

Thanks, Gareth. We are using Eviews 9 Enterprise Edition (October 22, 2015 build) and Excel 2010. I don't see the contradiction in my original post. On our machines, when we use wfopen to read data in from the Excel file while it is open, and subsequently make a change to the Excel file, Excel will no longer prompt us to save upon exiting.

Perhaps my use of "should" was unclear - in a normative sense, I certainly agree that Excel should prompt me to save - the problem is that it doesn't prompt me to save. My statement "Excel should not prompt you to save" was meant to be predictive - if you experience the same problem we are having, Excel will not prompt you to save after using wfopen to read data from an open workbook.

Thanks for any thoughts.

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Unfortunate glitch using wfopen to read Excel files

Postby EViews Steve » Wed May 04, 2016 5:50 pm

This sounds really strange.

When Excel has the file open, it locks the file. This means that when EViews tries to read the file, we have to ask Excel via COM for the data. During that procedure we do not tell Excel to save any changes or to ignore any changes upon close.

My guess is that this is a problem with Excel or one of its addins. Since we can't reproduce it here, try disabling all Excel addins, restart both Excel and EViews and try the import again.

Also you mentioned the excel 2010 as the file type. Are you running excel 2010 or something newer?

Steve

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: Unfortunate glitch using wfopen to read Excel files

Postby EViews Jason » Thu May 05, 2016 9:13 am

After you close the modified excel file which does not prompt to save (when it should) and reopen the file are your changes there?

So the question is, does Excel not prompt because a)it thinks the file has already been saved or b)it thinks the file has not been modified and therefore does not need to prompt to save?

gabrielehrlich
Posts: 6
Joined: Thu Apr 14, 2016 1:07 pm

Re: Unfortunate glitch using wfopen to read Excel files

Postby gabrielehrlich » Sat May 07, 2016 1:29 pm

Thanks for your support on this issue, Steve and Jason.

Steve, we are running Excel 2010. We just tried disabling all of the add-ins and restarting the programs, and the problem persisted.

Jason, when we reopen the Excel files, the changes are NOT there. So the answer seems to be b)it thinks the file has not been modified and therefore does not need to prompt to save.

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Unfortunate glitch using wfopen to read Excel files

Postby EViews Steve » Mon May 09, 2016 9:12 am

Ah, I was able to reproduce the problem and I found the issue. It turns out we were telling Excel to suppress all user dialogs while we were using it. I've changed this to only suppress while we are actively reading data, then reverting that setting back to the original value once we're done with the actual import.

This fix will be released in the next patch.

Steve

gabrielehrlich
Posts: 6
Joined: Thu Apr 14, 2016 1:07 pm

Re: Unfortunate glitch using wfopen to read Excel files

Postby gabrielehrlich » Wed May 11, 2016 11:52 am

Thanks very much, Steve!

Gabe

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Unfortunate glitch using wfopen to read Excel files

Postby EViews Steve » Wed May 11, 2016 11:53 am

Patch was released today.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests