MacroShop icon indicating copy to clipboard operation
MacroShop copied to clipboard

can't save file more than 64 kb

Open praveenyadav1602 opened this issue 7 years ago • 7 comments

after convert .exe to macros through exeinvba.py if output vbs more then 64 kb then we can't save as .xls file.

it always show when i save .xls file Errors were detected while saving (filename). Microsoft excel may be able to save the file by removing or repairing some features. To make the repairs in a new file click Continue. To cancel saving the file click Cancel.

i had tried with excel 2010 and 2013 tried with small .exe file, its working very good.

praveenyadav1602 avatar Sep 20 '17 13:09 praveenyadav1602

I'll take a look at this, but I'm fairly certain I was able to save larger files using MS 97-2003 xls format.

khr0x40sh avatar Sep 20 '17 15:09 khr0x40sh

i am also trying with MS 97-2003 .xls format.

on excel 2010 it will save as .xls file but when opening show error "Error occurred while loading this workbook. Do you want to continue loading project?" after choosing yes it failed to execute .exe

and on excel 2013 its failed to save save .xls file. error:

Errors were detected while saving (filename). Microsoft excel may be able to save the file by removing or repairing some features. To make the repairs in a new file click Continue. To cancel saving the file click Cancel.

i am using win 8 in both cases. the problem is only with files that are more than 64 kb.(means where more variable created, more then var0 )

Private Function var1 As String Private Function var2 As String Private Function var3 As String Private Function var4 As String ... ... ...

praveenyadav1602 avatar Sep 20 '17 16:09 praveenyadav1602

I'm still digging into this. I think one potential workaround is to store the data in the workbook fields and then use the macro to extract them from the fields. If I can get around to updating it this week, you'll see a new push soon.

khr0x40sh avatar Oct 06 '17 13:10 khr0x40sh

Also I wonder (maybe more like planning to see if feasible) if I can just write the xls using python myself thereby skipping the the import into Excel step.

As far as additional help, you could always ask @cr4nkapotomus for help

khr0x40sh avatar Oct 06 '17 13:10 khr0x40sh

An update:

It looks like the max length of a string per cell is roughly 32767 (In practice I only saw 32757, so I don't know where the discrepancy lies). In my short tests using the worksheet, it is possible to write a file well over 64k. I was able to write a file of roughly 1,670,607 bytes using 50 rows of 32767 A's, so I'd say this is the way of future releases. I will be pushing an update to github as soon as I get the python right for creating the xls from scratch (yikes!)

khr0x40sh avatar Oct 06 '17 17:10 khr0x40sh

thanks.

praveenyadav1602 avatar Oct 07 '17 05:10 praveenyadav1602

For your info, I did manage to make file embedding in VBA work. Even with 1M file like calc. If you are interrested by the code, its in https://github.com/sevagas/macro_pack/blob/master/src/modules/mp_generator.py function embedFile and relies on "WriteBytes" rather than base 64

sevagas avatar Jan 07 '18 10:01 sevagas