Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel 2000 - Which VBA project is ActiveProject?

Hi.

When you open Excel 2000, it opens a default blank
worksheet.
If I then open a worksheet containing VBA code, and run
the code, why does Excel still think that

Application.VBE.ActiveVBProject

is the project belonging to the default blank sheet, and
not the one belonging to the activeworkbook ?

Is this a bug? I can't see how, when code is actually
running, the project running that code is not seen by VBA
as the ActiveProject.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel 2000 - Which VBA project is ActiveProject?

Just like you can have calculation going on in a sheet that is not the
activesheet or run code on such sheets/workbook, the activeproject has no
correlation to the code that is running. Use

thisworkbook.VBProject

--
Regards,
Tom Ogilvy

Lizzie wrote in message
...
Hi.

When you open Excel 2000, it opens a default blank
worksheet.
If I then open a worksheet containing VBA code, and run
the code, why does Excel still think that

Application.VBE.ActiveVBProject

is the project belonging to the default blank sheet, and
not the one belonging to the activeworkbook ?

Is this a bug? I can't see how, when code is actually
running, the project running that code is not seen by VBA
as the ActiveProject.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2000 - Which VBA project is ActiveProject?

Tom

Thanks for that - I'd found that was the only way around
it - I'm assuming this is a bug ?

Cheers

Lizzie

-----Original Message-----
Just like you can have calculation going on in a sheet

that is not the
activesheet or run code on such sheets/workbook, the

activeproject has no
correlation to the code that is running. Use

thisworkbook.VBProject

--
Regards,
Tom Ogilvy

Lizzie wrote in message
...
Hi.

When you open Excel 2000, it opens a default blank
worksheet.
If I then open a worksheet containing VBA code, and run
the code, why does Excel still think that

Application.VBE.ActiveVBProject

is the project belonging to the default blank sheet, and
not the one belonging to the activeworkbook ?

Is this a bug? I can't see how, when code is actually
running, the project running that code is not seen by

VBA
as the ActiveProject.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2000 - Which VBA project is ActiveProject?


Ahem - ignore previous reply.
I was unsure why it worked ok in Office 97 but not in 2000.
Browsing MS I did find an article
http://support.microsoft.com/?kbid=260993 that suggests
that one should use
Application.VBE.ActiveVBProject.VBComponents if you want
to refer to the project of the active workbook. I'm just
not sure why my workbook is not seen as the active one
during the running of the code.

-----Original Message-----
Just like you can have calculation going on in a sheet

that is not the
activesheet or run code on such sheets/workbook, the

activeproject has no
correlation to the code that is running. Use

thisworkbook.VBProject

--
Regards,
Tom Ogilvy

Lizzie wrote in message
...
Hi.

When you open Excel 2000, it opens a default blank
worksheet.
If I then open a worksheet containing VBA code, and run
the code, why does Excel still think that

Application.VBE.ActiveVBProject

is the project belonging to the default blank sheet, and
not the one belonging to the activeworkbook ?

Is this a bug? I can't see how, when code is actually
running, the project running that code is not seen by

VBA
as the ActiveProject.



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Excel 2000 - Which VBA project is ActiveProject?

Lizzie,

That KB article is misleading. You should NOT use

Application.VBE.ActiveVBProject.VBComponents

to get the VBComponents of the ActiveWorkbook. Instead, use

ActiveWorkbook.VBProject.VBComponents.

There is no connection between what may be the ActiveWorkbook in Excel and
what may be the ActiveVBProject in the VBA Editor. Excel and VBA don't talk
to each other in this context.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Lizzie" wrote in message
...

Ahem - ignore previous reply.
I was unsure why it worked ok in Office 97 but not in 2000.
Browsing MS I did find an article
http://support.microsoft.com/?kbid=260993 that suggests
that one should use
Application.VBE.ActiveVBProject.VBComponents if you want
to refer to the project of the active workbook. I'm just
not sure why my workbook is not seen as the active one
during the running of the code.

-----Original Message-----
Just like you can have calculation going on in a sheet

that is not the
activesheet or run code on such sheets/workbook, the

activeproject has no
correlation to the code that is running. Use

thisworkbook.VBProject

--
Regards,
Tom Ogilvy

Lizzie wrote in message
...
Hi.

When you open Excel 2000, it opens a default blank
worksheet.
If I then open a worksheet containing VBA code, and run
the code, why does Excel still think that

Application.VBE.ActiveVBProject

is the project belonging to the default blank sheet, and
not the one belonging to the activeworkbook ?

Is this a bug? I can't see how, when code is actually
running, the project running that code is not seen by

VBA
as the ActiveProject.



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel 2000 - Which VBA project is ActiveProject?

I gave you the correct answer. It isn't a bug - it is the way it works.
As I said, there is no correlation between the activeproject and the
activeworkbook. I believe the article is refering to the ActiveProject as
the ActiveWorkbook creating your confusion.

You might note, that in the article at the start of the routine, they
specifically name the workbook.

If you want the project of the ActiveWorkbook (as opposed to the workbook
running the code - but the workbook running the code might be the
activeworkbook as well)

ActiveWorkbook.VBProject

if you want the workbook running the code:

ThisWorkbook.VBProject

Your experience proves that the ActiveProject and ActiveWorkbook are not
correlated.

--
Regards,
Tom Ogilvy



Lizzie wrote in message
...

Ahem - ignore previous reply.
I was unsure why it worked ok in Office 97 but not in 2000.
Browsing MS I did find an article
http://support.microsoft.com/?kbid=260993 that suggests
that one should use
Application.VBE.ActiveVBProject.VBComponents if you want
to refer to the project of the active workbook. I'm just
not sure why my workbook is not seen as the active one
during the running of the code.

-----Original Message-----
Just like you can have calculation going on in a sheet

that is not the
activesheet or run code on such sheets/workbook, the

activeproject has no
correlation to the code that is running. Use

thisworkbook.VBProject

--
Regards,
Tom Ogilvy

Lizzie wrote in message
...
Hi.

When you open Excel 2000, it opens a default blank
worksheet.
If I then open a worksheet containing VBA code, and run
the code, why does Excel still think that

Application.VBE.ActiveVBProject

is the project belonging to the default blank sheet, and
not the one belonging to the activeworkbook ?

Is this a bug? I can't see how, when code is actually
running, the project running that code is not seen by

VBA
as the ActiveProject.



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA project created in Excel 2003 doesn't run in Excel 2000 Rick_T Excel Discussion (Misc queries) 3 January 16th 07 04:25 AM
How do I create project schedule using excel - office 2000 raeisza Excel Discussion (Misc queries) 1 January 5th 05 08:31 AM
Excel 2000: Workbook has lost VBA Project Dave Peterson[_3_] Excel Programming 0 September 24th 03 02:12 AM
Excel 2000: Workbook has lost VBA Project Jim Rech Excel Programming 0 September 23rd 03 07:19 PM
Excel 2000: Workbook has lost VBA Project Serge[_2_] Excel Programming 0 September 23rd 03 07:07 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"