View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Excel 2007 does NOT keep vb library references ...

I would however be interested in Microsoft's official response to this issue
You read it

This was actually a security decision that we made - not to persist the VBA project (which includes references) - if there wasn't
any code/modules in the project, since just persisting an loading the VBA project itself increases the attack surface of the
product.


If you need help with the macro let me know



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Sean" wrote in message ...
Dear Rob (or should it be Ron?)

Firstly thank you to you both for confirming my suspicions regarding
the solution to my problem.

I might try to write the code to insert a module into a spreadsheet
(I've never done any coding that CREATES code) so it should be an
interesting experience. The only real problem is that the files that
will need updating are in many directories on many volumes, so being
able to change them on mass would involve spending more time
identifying the files than actually "correcting" them, but that's my
problem.

Honestly, I am a bit disappointed with this result as it means a minor
change to a major number of files for a reason I find quite
unjustifiable. I would however be interested in Microsoft's official
response to this issue (I'm assuming this was the gist of your
discussion with Rob).

Thanks again boys, and if I create a useful solution I'll post the
code here


Sean.



On Aug 30, 11:18 pm, "Ron de Bruin" wrote:
Hi Sean

Update:

This was actually a security decision that we made - not to persist the VBA project (which includes references) - if there wasn't
any code/modules in the project, since just persisting an loading the VBA project itself increases the attack surface of the
product.

We can make a macro that open each file in a folder and insert a empty module if you want ?
Maybe I will create a page about it

Let me know if you want to try a macro

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"Sean" wrote in ...
Hello out there in Excel programming land ...


I am looking to upgrade (migrate) a set of Excel workbooks from 2003
to 2007.


The basic concept is that there is a single workbook (called say
MACRO.xls) that contains all VBA code (function, procedures, form,
etc.) which is ALWAYS open on the users pc, this way any file the user
is working on (called say USER.xls) can easily access the necessary
code/information as it is linked to MACRO.xls via a VBA reference.


This does not seem to work in Excel 2007, assuming that my macro
security is set to Medium and USER.xls is a file previously created ni
Excel2003, if I do the following (which is long winded, but
demonstrates my point) :-


1) Open MACRO.xls (usual warning messages about enabling macros in a
workbook)
2) Open USER.xls (no warnings as this file does NOT contain any
code)
3) Go to visual basic and check out the references, there is no
reference in USER.xls to MACRO.xls (which there was previously in
Excel 20003)
4) So I put back in the reference to MACRO.xls.
5) Save USER as a .xlsx, .xlsm, .xlsb file. I should be only saving
as a .xlsx file as USER contains NO code.
6) Open each of the USER spreadsheets in turn, check out visual
basic and the reference to MACRO.xls has been removed.


Currently I have hundreds of Excel 2003 workbooks that contain NO code
BUT have a reference to another Excel workbook, if the above is true
then NONE of these spreadsheets will function any more.


There is a solution.


But not a good one.


If after step 4), I insert a module into the USER workbook and save as
a .xlsm file (because it NOW contains code). NOW the reference to
MACRO.xls is still present whenever I open the USER file.
This is is a impratical solution as this would mean inserting an empty
module into every one of my current spreadsheets.


I cannot help thinking that I am missing some simple point in this
process.


Can anyone help


Sean


P.S. I just realised that the above could be a bit confusing, so here
is a simpler example.
1) Create a blank workbook in Excel 2007
2) In visual basic add a reference to anything (say "Microsoft
Powerpoint 12.0 object library")
3) Save the work as a .xlsm workbook and close it
4) Re-open the workbook
5) Check your references in visual basic and you will see that
the powerpoint reference has disappeared
,,,
6) Repeat but after step 2) insert a blank module into your
workbook, now all works fine- Hide quoted text -


- Show quoted text -