Book a Demo

Author Topic: RTE VBA  (Read 3662 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
RTE VBA
« on: November 21, 2006, 02:46:38 pm »
Hi,

I'm trying to round-trip-engineer some MS Word 2000 VBA code.

I've set the language to VB6

However, the following VB Attributes:

Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False

do not round-trip in Word.

That is, they are set by EA on Forward Engineer (Generate) but if I import the module into Word and then export it again, they are not preserved.

This means it is not possible to use file comparators (such as Beyond Compare) to track changes as there are ALWAYS meaningful changes...

Is there any way to suppress their Generation?  (Even if registry settings)

TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: RTE VBA
« Reply #1 on: November 21, 2006, 03:19:11 pm »
Well, for starters you can remove those lines from the Class Declaration template.

It may also be worth checking what version of VBA is being used by word.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: RTE VBA
« Reply #2 on: November 21, 2006, 05:25:50 pm »
Quote
Well, for starters you can remove those lines from the Class Declaration template.

It may also be worth checking what version of VBA is being used by word.
That will do thanks, Simon.   :D

I suspect Word VBA is more like VB4.  Does anybody know?

Paolo

Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: RTE VBA
« Reply #3 on: November 21, 2006, 07:10:49 pm »
I reached a similar conclusion myself at one point.  But I don't know it for certain.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: RTE VBA
« Reply #4 on: November 21, 2006, 07:13:42 pm »
Quote
I reached a similar conclusion myself at one point.  But I don't know it for certain.
Having had a look at the code templates, I can see a number are customised for VB5 vs VB6

Would it be possible to get VB4 added and then we can customise the templates more "Correctly"?

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Support for VB4 (MS Office 200 VBA)
« Reply #5 on: November 22, 2006, 06:52:49 pm »
Quote
Would it be possible to get VB4 added and then we can customise the templates more "Correctly"?
Further to this suggestion:

You can jury-rig a solution with the following changes:
In the t_genopt table, change the value in the Option column for the class row form:
sVVersion=5.0 or sVVersion=6.0 (depending on your current setting) to sVVersion=4.0 - this is NOT currently allowed by the GUI but hopefully it will...

In the Visual Basic Class Declaration template add the conditional:
Attribute VB_Name = "%className%"
%if genOptVBVersion != "4.0"%
Attribute VB_GlobalNameSpace = %genOptVBGlobal == "T" ? "True" : "False"%
Attribute VB_Creatable = %genOptVBCreatable == "T" ? "True" : "False"%
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = %genOptVBExposed == "T" ? "True" : "False"%
Attribute VB_Ext_KEY = "SavedWithClassBuilder" , "Yes"
Attribute VB_Ext_KEY = "Top_Level" , "Yes"
%endIf%
Option Explicit\n

and in the Class template change the conditional from:
%if genOptVBVersion != "5.0"%
to
%if genOptVBVersion == "6.0"%

Then, as my son says...  "It's all good!"

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: RTE VBA
« Reply #6 on: November 23, 2006, 04:24:51 am »
The problem is that VBA has its own version and specific syntax idiosyncrasies.

For some time now VBA has been at the 5.3 version level. This does not have any parallel with VB versions, and actually postdates VB 6.0.

There was an earlier version of VBA, and it was very much like VB 4. However, a lot of products have included the more recent VBA engine over the past (almost) 10 years so its unlikely you have this version.

Take a look in the registry or something - I simply don't know where to look, and my copy of the documentation is in the (hard to get to) archives - and perhaps you can find the VBA version.

Since VBA is so incredibly common, and since there are some (fairly limited) version differences from VB 6, it might be worth adopting VBA as yet another dialect for EA. As far as VB 4 goes, the macro tweak is perhaps the best bang for the buck. Even VB 6 is now a decade old, and VB 4 has essentially disappeared. [Yes, I know we dinosaurs see it occasionally, but some of us even feel the 60's really happened. Who you going to believe?]

HTH, David
No, you can't have it!