Home All Groups Group Topic Archive Search About

VB6 IDE VBE Object reference

Author
20 Sep 2005 12:32 AM
PastorMike
I want to set an object variable to the current instance of the VBProject in
VB6.  It should look something like "Set VBI = VBIDE.VBE.VBProjects(1)".

In Excel 2000 this can be done simply by "Set VBI =
Application.VBE.VBProjects(1)" or "Set VBI = Application.VBE.ActiveVBProject"

How do I do this in the VB6 IDE?  I could find no trace on the web of sample
code to access this object straghtforwardly.  I do not want to connect an
add-in, and use the VBInst object generated by _OnConnection as my entry
point.  That seems pointlessly circuitous, given how easy it is in Excel VBA.

Author
20 Sep 2005 12:58 AM
Bob Butler
Show quote Hide quote
"PastorMike" <PastorM***@discussions.microsoft.com> wrote in message
news:4E65F90E-A46B-4376-80FD-0254CA928156@microsoft.com
> I want to set an object variable to the current instance of the
> VBProject in VB6.  It should look something like "Set VBI =
> VBIDE.VBE.VBProjects(1)".
>
> In Excel 2000 this can be done simply by "Set VBI =
> Application.VBE.VBProjects(1)" or "Set VBI =
> Application.VBE.ActiveVBProject"
>
> How do I do this in the VB6 IDE?  I could find no trace on the web of
> sample code to access this object straghtforwardly.  I do not want to
> connect an add-in, and use the VBInst object generated by
> _OnConnection as my entry point.  That seems pointlessly circuitous,
> given how easy it is in Excel VBA.

In Excel you are always running in the "IDE" so in a sense every VBA project
is an add-in already.  When you compile a VB project the IDE is gone so
there is no "Application" reference.    AFAIK there's no way to get a direct
reference to the IDE from within a VB project except via the add-in route.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
20 Sep 2005 2:03 AM
PastorMike
Thanks, Bob.
Since all I want to do is install and register the VB6 Mouse Wheel Fix
automatically, and since the VBA routine I wrote in Excel to do it seems to
register the dll for the VB6 IDE as well, I guess I should just run the Excel
code, and then open the VB6 Add-In Manager and check the Load on Startup box.
And I was going to have such fun watching it happen with a single click...


Show quoteHide quote
"Bob Butler" wrote:

> "PastorMike" <PastorM***@discussions.microsoft.com> wrote in message
> news:4E65F90E-A46B-4376-80FD-0254CA928156@microsoft.com
> > I want to set an object variable to the current instance of the
> > VBProject in VB6.  It should look something like "Set VBI =
> > VBIDE.VBE.VBProjects(1)".
> >
> > In Excel 2000 this can be done simply by "Set VBI =
> > Application.VBE.VBProjects(1)" or "Set VBI =
> > Application.VBE.ActiveVBProject"
> >
> > How do I do this in the VB6 IDE?  I could find no trace on the web of
> > sample code to access this object straghtforwardly.  I do not want to
> > connect an add-in, and use the VBInst object generated by
> > _OnConnection as my entry point.  That seems pointlessly circuitous,
> > given how easy it is in Excel VBA.
>
> In Excel you are always running in the "IDE" so in a sense every VBA project
> is an add-in already.  When you compile a VB project the IDE is gone so
> there is no "Application" reference.    AFAIK there's no way to get a direct
> reference to the IDE from within a VB project except via the add-in route.
>
> --
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>
>
Author
20 Sep 2005 1:20 AM
Ken Halter
Show quote Hide quote
"PastorMike" <PastorM***@discussions.microsoft.com> wrote in message
news:4E65F90E-A46B-4376-80FD-0254CA928156@microsoft.com...
>I want to set an object variable to the current instance of the VBProject
>in
> VB6.  It should look something like "Set VBI = VBIDE.VBE.VBProjects(1)".
>
> In Excel 2000 this can be done simply by "Set VBI =
> Application.VBE.VBProjects(1)" or "Set VBI =
> Application.VBE.ActiveVBProject"
>
> How do I do this in the VB6 IDE?  I could find no trace on the web of
> sample
> code to access this object straghtforwardly.  I do not want to connect an
> add-in, and use the VBInst object generated by _OnConnection as my entry
> point.  That seems pointlessly circuitous, given how easy it is in Excel
> VBA.

As Bob mentioned, VBE is the VB Extensibility model and is for use with
add-in's only.

How To Create a Basic Add-in Using VB5 or VB6
http://support.microsoft.com/default.aspx?scid=kb;en-us;189468

Why do you need this info? You can use the App object to get the title/name
of your project at any time.

   App.Title
   App.EXEName

fwiw, there's a ton of built in stuff in Excel/Access that you don't get
"out of the box" with VB. That can be good or bad, depending on how you look
at it. If VB had everything but the kitchen sink, we'd have been
distributing .Net Framework sized packages back in the floppy days (I can't
even imagine <g>)

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..