Re: beginner question: VBA --> VB?

From: Karl E. Peterson (karl_at_mvps.org)
Date: 02/02/05


Date: Wed, 2 Feb 2005 11:24:23 -0800

Abeness wrote:
> Thanks, guys. Responding to all in one post to keep things cleaner.
>
> Karl E. Peterson wrote:
>> Assuming you make an explicit reference to Ventura in your VB
>> project, there's nothing there that isn't fully supported by Classic
>> VB.
>
> Excellent, thanks. By an explicit reference, do you mean referencing
> the Ventura TLB?

Right. Project menu, References... I don't have Ventura, so I can't point to the
right box in that list.

> BTW, cool site, Karl. McKinney's book looks
> *excellent.* Kudos for convincing the PTB to allow you to host it and
> for putting the work into converting it. Looks great.

Thanks! :-)

> One problem is that I can't figure out how to detect whether Ventura
> is already running, though that doesn't seem to matter insofar as
>
> oV10 = New Ventura.VPAutoObj
>
> doesn't create a second app instance if Ventura is already running, it
> reuses the existing one. GetObject and CreateObject didn't work from
> VBA--got the error "ActiveX component can't create object". Either a
> syntax error, or a limitation of Ventura? Only the first app instance
> can be controlled, FYI.

Is this still an issue? Could be something really simple, or could be that library
isn't very amenable to outside automation.

> I did notice that, after my VB.NET EXE creates the new publication
> (FileNew) and creates the frames (FormatCreateFrame), if I close the
> publication it created, Ventura itself closes. Any way around that?
> Why is this happening?

It totally depends on that host application, and how it reacts to the methods it
exposes for you to call.

> I'm suspecting it's some new .NET garbage cleanup thing,

If this only happens from VFred, and not ClassicVB, automation, well, yeah, you could
very well be looking at an issue related to the lack of reference counting and
lifetime control. (This happens to be one of the principle reasons many cite for not
migrating to .NET, even if it did support ClassicVB syntax!)

>> * Follow Next with the index variable in question.
>
> OK. Out of curiosity, why is this necessary? Isn't it always assumed
> in a For...Next statement?

It's not necessary, but makes the code far more readable. Especially with nested
loops. (Rule#1 in MSBasic-Land: Never trust default behaviors! <g> If you have the
opportunity to be explicit, grab it!)

>> * Don't hardcode path/filenames.
>
> It was quick and dirty for demo purposes... I know.

Figured, but couldn't resist. ;-)

Later... Karl

-- 
[Microsoft Basic: 1976-2001, RIP]


Relevant Pages

  • Re: beginner question: VBA --> VB?
    ... > Assuming you make an explicit reference to Ventura in your VB project, ... Ventura TLB? ... BTW, cool site, Karl. ... syntax error, ...
    (microsoft.public.vb.syntax)
  • Re: alternative to gettickcount
    ... Karl already jumped you. ... (I always got a kick back then when Dr. Dobbs sung the revolutionary praises ... of SmallTalk and Java because they didn't use pointers. ... Smart Pointers and Reference Counting, as a "simple reference count garbage ...
    (microsoft.public.vb.general.discussion)
  • Re: Deep Thoughts # 17: Liar Paradox is a Formal Metamathematical Theorem
    ... It sure doesn't look that way: there is no explicit reference to time in ... By "it" do you mean time, or the Liar sentence, or its paradoxical ... the simple solution to the Barber paradox is that there can not be ...
    (sci.math)
  • Re: Deep Thoughts # 17: Liar Paradox is a Formal Metamathematical Theorem
    ... It sure doesn't look that way: there is no explicit reference to time in ... By "it" do you mean time, or the Liar sentence, or its paradoxical ... the simple solution to the Barber paradox is that there can not be ...
    (sci.logic)
  • Re: Using VB app to show Excel?
    ... string, then calls Word and opens the file named in the string. ... References have a MISSING reference to Word 10.0. ... Karl. ...
    (microsoft.public.vb.general.discussion)