You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by acichon89 <ac...@gmail.com> on 2012/09/27 10:45:17 UTC

Saving WorkBook deletes VBA modules

I'm using apache poi 3.8 
ProActiveX.xls
<http://apache-poi.1045710.n5.nabble.com/file/n5711016/ProActiveX.xls>  

ProActive.xls is the file I'm working on.
Any, even the simples code (just read the file, and write) causes my new
excel file crashes when I want to load macros. My macros are in modules,
when I try to load macros I got error in Microsoft Excel that cannot load
the:

pop_Model
pop_pathNetworks
get_sim_options
get_user_distrib
pop_user_distrib
get_arrival_cycles
pop_arrival_cycles
get_path_networks
get_subroutines
pop_subroutines
pop_sim_options

When I load my VBA macros I can see blank page on this modules. 

Here is the way I do read/write in Java:

/File workbookFile = new File(PROACTIVEX_LOCATION);        
//PROACTIVE_LOCATION is just static String with path
FileInputStream fis = new FileInputStream(workbookFile);
this.wb = WorkbookFactory.create(fis);

FileOutputStream fileOut = new FileOutputStream(PROACTIVEX_LOCATION);
 wb.write(fileOut);
fileOut.close();/



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Saving-WorkBook-deletes-VBA-modules-tp5711016.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Saving WorkBook deletes VBA modules

Posted by Nick Burch <ap...@gagravarr.org>.
On Thu, 27 Sep 2012, acichon89 wrote:
> Any, even the simples code (just read the file, and write) causes my new
> excel file crashes when I want to load macros. My macros are in modules,
> when I try to load macros I got error in Microsoft Excel that cannot load
> the:

You need to open the HSSFWorkbook with the preserveNodes flag if you have 
things like macros. You may also need to bump up the memory you give to 
the system - preserving nodes takes more memory. It's a flag to 
HSSFWorkbook when you create

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Saving WorkBook deletes VBA modules

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
Must admit that I do not know the answer and googling around for a while has
not helped me in this matter. Have you tried to run the file through
BiffViewer
(http://poi.apache.org/apidocs/org/apache/poi/hssf/dev/BiffViewer.html) yet
to see if it is able to recognise/read the stream of data that contains the
modules? My suspicion is that modules may have been introduced into the BIFF
file format after the version (BIFF8) that POI targets, but I have not been
able to discover any information that tells me whether or not this is the
case.

Yours

Mark B



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Saving-WorkBook-deletes-VBA-modules-tp5711016p5711017.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org