VBA Macro cannot see hidden workbook

  • Thread starter andjbird via OfficeKB.com
  • Start date
A

andjbird via OfficeKB.com

I have developed an VBA macro for MS Excel that uses a hidden Excel workbook
as a database. To check that the database is present, I use a routine the
iterates through the workbooks contained in command word Application, i.e.:

Dim wkb As Workbook

For Each wkb In Application.Workbooks

{Check whether workbook is database workbook}

Next wkb


The routine works fine on my machine. However, for some reason the routine
will not work properly on a colleagues machine. It seems to fail due to the
fact that the database workbook is hidden.

In the visual basic editor edit mode setting a watch to the command word;
Applications.Workbooks it seems to recognise that the workbook is present
within the application. However, whenever I try to access the workbook entry
via the watch the Excel application crashes.

Why should this happen on one machine and not others? Does anyone have any
suggestions to overcome this problem? Can I perhaps use some alternative
routine?

Regards

Andy B
 
C

Charles Kenyon

You might want to ask this in an Excel newsgroup rather than a Word
newsgroup.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide




--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top