Page 1 of 1

Problem with VBA-code when saving data to xlsm-files

Posted: Wed Oct 12, 2022 5:02 am
by johansamuelsson
Hi

At my workplace we have started using Eviews 13 and having problems with xlsm-files that have VBA code.

When we are saving data to a larger xlsm-files, with multiple sheets, and with VBA-code, the file becomes corrupted. Excel says "We found a problem with some content in 'Test.Xlsm'. Do you want to try to recover as much as possible? Click yes if you trust the source of the workbook". When wee try to recover the file excel says that the VBA-code is removed.

The same code works fine in Eviews 12. Can we email you the files if you can run a test?

We use Eviews 13, Standar Edition – Oct 11 2022 build.

(If we delete all sheets except the sheet that we ar saving data to everything works fine)

Regards Johan

Re: Problem with VBA-code when saving data to xlsm-files

Posted: Wed Oct 12, 2022 2:59 pm
by EViews Jason
Hello Johann.

For EViews 13 we introduced a new Excel writing engine. The new engine apparently is not compatible with macro enabled Excel files (xlsm). If you could send me your xlsm file to jason@eviews.com, we will look into possibly fixing it.

In the meantime, use the 'legacy' option when writing your Excel files. This will use the same writing engine as EViews 12.

So if your old command was

Code: Select all

wfsave(type=excelxml, mode=update) test.xlsm
change it to:

Code: Select all

wfsave(type=excelxml, mode=update,legacy) test.xlsm

Re: Problem with VBA-code when saving data to xlsm-files

Posted: Thu Oct 13, 2022 1:10 am
by johansamuelsson
Ok, works fine with "legacy"-command. Perhaps the "legacy"-option should be the default for all-xlsm files when using wfsave

I am sending an email with two attached files, "Test.prg" and "Test.xlsm" so you can test

Thanks!

Regards Johan

Re: Problem with VBA-code when saving data to xlsm-files

Posted: Fri Dec 09, 2022 5:40 pm
by EViews Jason
This will be fixed in the next patch

Re: Problem with VBA-code when saving data to xlsm-files

Posted: Tue May 16, 2023 2:18 am
by TomasThoren
Hi,

i would just like to add to this thread that we have the same problem (excel files becomes corrupted when saved to), but also with ordinary excelfiles (.xlsx).

Kind regards
Tomas

Eviews 13 (Enterprise Edition – Apr 18 2023 build)