Results 1 to 8 of 8
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    VBA: O2k vs O97 (Win98/NT O97)

    I'm sorry if this has already been covered (I couldn't find anything, though) but someone who should know (!) told me a while back that VBA was radically changed in O2k and all programs, macros etc written in O97 VBA would have to be written again from scratch for O2k. However, everything I've seen on this board seems to indicate that this is very far from true.

    Would somebody very kindly set me straight, please? I'm looking to upgrade very soon and would appreciate knowing what's going on before I do so!
    Beryl M


  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: VBA: O2k vs O97 (Win98/NT O97)

    Beryl,

    Go ahead and upgrade and don't worry about it. Office 2K VBA uses VB6 while Office 97 uses VB5, but the changes are relatively minor, and virtually everything written for 97 should run fine in 2K without any changes. Only exception to this might be Access, but others here will be able to give you better info on that. Dunno what that person was smoking...

    Gary

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: VBA: O2k vs O97 (Win98/NT O97)

    Thanks for that, Gary - you've set my mind at rest. I've a feeling that, because the person concerned was trying to sell some software at the time he may have been, as they say, economical with the truth!

    I don't need to worry about Access too much, it was mostly Word and Excel I was worried about. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    Beryl M


  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA: O2k vs O97 (Win98/NT O97)

    You also need to worry about the SDI/MDI difference.
    See the VBA Code Snippets example at my URL below.

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: VBA: O2k vs O97 (Win98/NT O97)

    Hmm. I see what you mean (or rather I don't, since I can't run it until I do upgrade, but you get the idea). I've made a note of the url for use when I get to it, thank you very much.
    Beryl M


  6. #6
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA: O2k vs O97 (Win98/NT O97)

    I have read everyone else's posts to your question and at least for Excel I can definitely say there are MANY differences in VBA. I have lost much hair and greatly extended my profanity vocabulary over these undocumented surprises. I have a project which must work in xl97 and xl2000 and I can easily list 10+ areas where the exact same code works in one version but not the other. This has nothing to do with any extra features in xl2000 or external references (I have intentionally used the lowest commom denominator of features on purpose). I'm just using the very basic package but have a complex project which only uses Excel as a UI and is about 15,000 lines of VBA. So far I have been able to write around these differences but it's only by trial & error that I have even found them in my code as it's hard enough to test every single line in both versions after I make any little change. I'd say in general if you're using simplistic VBA calls then you're probably safe but I would not release anything to your users until you run it all versions you expect them to use.

    Been Burned - Deb <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

  7. #7
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: VBA: O2k vs O97 (Win98/NT O97)

    Deb,

    Yeouch!
    Just wondering though: did the incompatibilities arise only when code was written in 2000 and then run on 97, or did you find code that was written on 97 did not work on 2000?

    If the former, then it still seems safe to advise someone that their 97 VBA projects are going to run OK when run on 2000. If the latter, it would be a valuable service if you could post a quick list of things Excel'ers should be on the lookout for when running 97 code on 2000.

    Gary

  8. #8
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA: O2k vs O97 (Win98/NT O97)

    To answer your question... I started off in xl97 and then ran the workbook in xl2000 and found some problems. I've been working on this project for almost a year and now the workbook has been opened, closed, saved, code added/removed, etc. in both versions. So the answer is NO, it's not safe to say that a workbook created in xl97 will always run fine in xl2000 (or the other way around). It depends on what your code is doing. I have 22 worksheets, 15 forms, 12 modules, 32 classes, ActiveX controls on all worksheets plus 15,000 lines of VBA behind all of this. I also dynamically build charts (which has caused most of the problems).

    Most of the problems are with a function failing in one version but works fine in the other.

    One chart problem (there are quite a few) is this:

    Set oCht = ActiveSheet.ChartObjects(whatChart)
    oCht.Activate
    oCht..BringToFront

    in xl2000 I do not need "oCht.Activate" before using .BringToFront . Also, .BringToFront fails if I have a chart data table enabled.

    At workbook_open I test if the user has xl97 or xl2000. If they have xl95 or XP I warn them that this workbook has not been tested in those versions and they're on their own (don't call me at 2am). I do not know if the service pack matters but since I can't determine which thing works or doesn't work in which pack, I'm not testing for those differences. I think my next major release of this project will be written in C++ with a database backend and just output the results to Excel, no VBA.

    Advice: Install xl97 and xl2000 on your PC, write some code, test it in both versions just in case. Don't assume it'll work (although I'd still say 90% works just fine -I'm not unlucky to find the last 10%).

    Deb <img src=/S/crazy.gif border=0 alt=crazy width=15 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •