PC Review


Reply
Thread Tools Rate Thread

Differente .xls files generated when VBE window closed vs open

 
 
=?Utf-8?B?TWFyaw==?=
Guest
Posts: n/a
 
      21st Jun 2007
While debugging some generated spreadsheets that are picked up by a third
party system, we found that the actual byte code of xls workbooks generated
in vba in Excel differ depending on wether or not the VBE window is open or
closed.

Has anyone run across this? The files generated when the VBE window is open
are always about 8k larger than when the VBE window is closed. Looking at
the files with a hex editor, the files are completely different.

The problem is that for some reason the 3rd party system will not handle the
file correctly unless it gets the format that is generated when the VBE
window is open. This causes us to open the VBE window programatically before
saving the file in code.

When opening both files separately in Excel all modules, properties etc are
identical.

File is being saved with

Application.VBE.MainWindow.Visible = True ( or False)

xlNewBook.SaveAs FileName:=strOutputPath & "_" & strWorkBookName, _
FileFormat:=-4143, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False, TextCodePage:=1100

Thanks in advance,
Mark
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      22nd Jun 2007
Hi Mark,

Indeed an xls that has been 'exposed' to an open VBE is saved with
additional data, even if no code or modules ever added. Such a file will
include "_VBA_PROJECT_CUR", I posted a routine that'll check all files in a
folder for that.

http://tinyurl.com/2jn79e

As I mentioned in the thread, that string merely confirms the file has been
'exposed' to the VBE, it may or may not include code or inserted modules.

> The problem is that for some reason the 3rd party system will not handle

the
> file correctly unless it gets the format that is generated when the VBE
> window is open.


This seems curious, why not, does that third party app want to add a project
password perhaps.

Regards,
Peter T



"Mark" <(E-Mail Removed)> wrote in message
news:C3C18EBA-7581-4B24-9DF3-(E-Mail Removed)...
> While debugging some generated spreadsheets that are picked up by a third
> party system, we found that the actual byte code of xls workbooks

generated
> in vba in Excel differ depending on wether or not the VBE window is open

or
> closed.
>
> Has anyone run across this? The files generated when the VBE window is

open
> are always about 8k larger than when the VBE window is closed. Looking at
> the files with a hex editor, the files are completely different.
>
> The problem is that for some reason the 3rd party system will not handle

the
> file correctly unless it gets the format that is generated when the VBE
> window is open. This causes us to open the VBE window programatically

before
> saving the file in code.
>
> When opening both files separately in Excel all modules, properties etc

are
> identical.
>
> File is being saved with
>
> Application.VBE.MainWindow.Visible = True ( or False)
>
> xlNewBook.SaveAs FileName:=strOutputPath & "_" & strWorkBookName,

_
> FileFormat:=-4143, Password:="", WriteResPassword:="", _
> ReadOnlyRecommended:=False, CreateBackup:=False,

TextCodePage:=1100
>
> Thanks in advance,
> Mark



 
Reply With Quote
 
=?Utf-8?B?TWFyaw==?=
Guest
Posts: n/a
 
      22nd Jun 2007
Thanks Peter, I will take a look - the external system does some strange
things with workbooks...


"Peter T" wrote:

> Hi Mark,
>
> Indeed an xls that has been 'exposed' to an open VBE is saved with
> additional data, even if no code or modules ever added. Such a file will
> include "_VBA_PROJECT_CUR", I posted a routine that'll check all files in a
> folder for that.
>
> http://tinyurl.com/2jn79e
>
> As I mentioned in the thread, that string merely confirms the file has been
> 'exposed' to the VBE, it may or may not include code or inserted modules.
>
> > The problem is that for some reason the 3rd party system will not handle

> the
> > file correctly unless it gets the format that is generated when the VBE
> > window is open.

>
> This seems curious, why not, does that third party app want to add a project
> password perhaps.
>
> Regards,
> Peter T
>
>
>
> "Mark" <(E-Mail Removed)> wrote in message
> news:C3C18EBA-7581-4B24-9DF3-(E-Mail Removed)...
> > While debugging some generated spreadsheets that are picked up by a third
> > party system, we found that the actual byte code of xls workbooks

> generated
> > in vba in Excel differ depending on wether or not the VBE window is open

> or
> > closed.
> >
> > Has anyone run across this? The files generated when the VBE window is

> open
> > are always about 8k larger than when the VBE window is closed. Looking at
> > the files with a hex editor, the files are completely different.
> >
> > The problem is that for some reason the 3rd party system will not handle

> the
> > file correctly unless it gets the format that is generated when the VBE
> > window is open. This causes us to open the VBE window programatically

> before
> > saving the file in code.
> >
> > When opening both files separately in Excel all modules, properties etc

> are
> > identical.
> >
> > File is being saved with
> >
> > Application.VBE.MainWindow.Visible = True ( or False)
> >
> > xlNewBook.SaveAs FileName:=strOutputPath & "_" & strWorkBookName,

> _
> > FileFormat:=-4143, Password:="", WriteResPassword:="", _
> > ReadOnlyRecommended:=False, CreateBackup:=False,

> TextCodePage:=1100
> >
> > Thanks in advance,
> > Mark

>
>
>

 
Reply With Quote
 
=?Utf-8?B?TWFyaw==?=
Guest
Posts: n/a
 
      26th Jun 2007
Solved this in case anyone is interested. In code added a dummy module to
VBComponent...seems to force save in Biff8 format.


"Mark" wrote:

> Thanks Peter, I will take a look - the external system does some strange
> things with workbooks...
>
>
> "Peter T" wrote:
>
> > Hi Mark,
> >
> > Indeed an xls that has been 'exposed' to an open VBE is saved with
> > additional data, even if no code or modules ever added. Such a file will
> > include "_VBA_PROJECT_CUR", I posted a routine that'll check all files in a
> > folder for that.
> >
> > http://tinyurl.com/2jn79e
> >
> > As I mentioned in the thread, that string merely confirms the file has been
> > 'exposed' to the VBE, it may or may not include code or inserted modules.
> >
> > > The problem is that for some reason the 3rd party system will not handle

> > the
> > > file correctly unless it gets the format that is generated when the VBE
> > > window is open.

> >
> > This seems curious, why not, does that third party app want to add a project
> > password perhaps.
> >
> > Regards,
> > Peter T
> >
> >
> >
> > "Mark" <(E-Mail Removed)> wrote in message
> > news:C3C18EBA-7581-4B24-9DF3-(E-Mail Removed)...
> > > While debugging some generated spreadsheets that are picked up by a third
> > > party system, we found that the actual byte code of xls workbooks

> > generated
> > > in vba in Excel differ depending on wether or not the VBE window is open

> > or
> > > closed.
> > >
> > > Has anyone run across this? The files generated when the VBE window is

> > open
> > > are always about 8k larger than when the VBE window is closed. Looking at
> > > the files with a hex editor, the files are completely different.
> > >
> > > The problem is that for some reason the 3rd party system will not handle

> > the
> > > file correctly unless it gets the format that is generated when the VBE
> > > window is open. This causes us to open the VBE window programatically

> > before
> > > saving the file in code.
> > >
> > > When opening both files separately in Excel all modules, properties etc

> > are
> > > identical.
> > >
> > > File is being saved with
> > >
> > > Application.VBE.MainWindow.Visible = True ( or False)
> > >
> > > xlNewBook.SaveAs FileName:=strOutputPath & "_" & strWorkBookName,

> > _
> > > FileFormat:=-4143, Password:="", WriteResPassword:="", _
> > > ReadOnlyRecommended:=False, CreateBackup:=False,

> > TextCodePage:=1100
> > >
> > > Thanks in advance,
> > > Mark

> >
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can macro open daily generated files? Valdemar Microsoft Excel Programming 5 20th Jan 2010 03:50 PM
how to open closed xls. files =?Utf-8?B?SmltYm8u?= Microsoft Excel Crashes 1 27th Aug 2007 09:15 AM
word documents open to a closed window, I have to click on file to =?Utf-8?B?Tmljaw==?= Microsoft Word New Users 0 4th Apr 2006 04:58 PM
Browser stops responding after window.open() window is closed TM360 Windows XP Internet Explorer 1 30th Jun 2005 06:47 PM
"Explorer.exe has generated errors and will be closed by Windows" when deleting files Steven Microsoft Windows 2000 0 4th Aug 2004 06:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:08 PM.