Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't save file more than 64 kb #16

Open
praveenyadav1602 opened this issue Sep 20, 2017 · 7 comments
Open

can't save file more than 64 kb #16

praveenyadav1602 opened this issue Sep 20, 2017 · 7 comments
Assignees

Comments

@praveenyadav1602
Copy link

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.

@khr0x40sh
Copy link
Owner

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.

@praveenyadav1602
Copy link
Author

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
...
...
...

@khr0x40sh
Copy link
Owner

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 khr0x40sh self-assigned this Oct 6, 2017
@khr0x40sh
Copy link
Owner

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
Copy link
Owner

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!)

@praveenyadav1602
Copy link
Author

thanks.

@sevagas
Copy link

sevagas commented Jan 7, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants