Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB versus VBA

VB versus VBA

Scheduled Pinned Locked Moved Visual Basic
algorithmsperformancequestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jgrogan
    wrote on last edited by
    #1

    Hi, As part of a short-term project to speed up a clients model, I have taken a financal model written in VBA and put it into VB, which I've compiled. However, the compiled VB model runs a little slower than the VBA. I had expected to get some speed gains, but not to have something that runs more slowly! Does anyone have any idea why this might be the case or pointers on how I might identify the problems? Searching on Google and Microsoft haven't thrown up any answers. Thanks, John.

    D 1 Reply Last reply
    0
    • J jgrogan

      Hi, As part of a short-term project to speed up a clients model, I have taken a financal model written in VBA and put it into VB, which I've compiled. However, the compiled VB model runs a little slower than the VBA. I had expected to get some speed gains, but not to have something that runs more slowly! Does anyone have any idea why this might be the case or pointers on how I might identify the problems? Searching on Google and Microsoft haven't thrown up any answers. Thanks, John.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      There's no way to tell without knowing anything about your code, what it's doing, where the slowdown is, ... Overall, the compiled VB6 executable should be faster than VBA, but that depends on a lot of things...

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      J 1 Reply Last reply
      0
      • D Dave Kreskowiak

        There's no way to tell without knowing anything about your code, what it's doing, where the slowdown is, ... Overall, the compiled VB6 executable should be faster than VBA, but that depends on a lot of things...

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        J Offline
        J Offline
        jgrogan
        wrote on last edited by
        #3

        Hi Dave, The code is a large financial model. It uses multiple classes and reads/writes to SQL server 2000 DB at the start and end. In short, the vast majority of the code is math operations - mostly fairly simple ones. There are also quite a lot of arrays which are read/written to. Both models use the same range of COM objects for further functionality. Can you outline some of the more common issues resulting in slower compiled VB6 code? Many thanks, John.

        Dave Kreskowiak wrote:

        There's no way to tell without knowing anything about your code, what it's doing, where the slowdown is, ... Overall, the compiled VB6 executable should be faster than VBA, but that depends on a lot of things...

        D 1 Reply Last reply
        0
        • J jgrogan

          Hi Dave, The code is a large financial model. It uses multiple classes and reads/writes to SQL server 2000 DB at the start and end. In short, the vast majority of the code is math operations - mostly fairly simple ones. There are also quite a lot of arrays which are read/written to. Both models use the same range of COM objects for further functionality. Can you outline some of the more common issues resulting in slower compiled VB6 code? Many thanks, John.

          Dave Kreskowiak wrote:

          There's no way to tell without knowing anything about your code, what it's doing, where the slowdown is, ... Overall, the compiled VB6 executable should be faster than VBA, but that depends on a lot of things...

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          jgrogan wrote:

          Can you outline some of the more common issues resulting in slower compiled VB6 code?

          You mean some of the millions of possibilities?? Seriously, it comes down to the quality of the code and exactly what it's doing. You also might have too much in the way of expectations on how fast the code should run compared to the VBA version. You might get 25% out of the VB6 version, if you're lucky. There are sections that will run faster, but this is limited to stuff that does NOT include database access, math operations, and COM objects, interprocess communication, among others. VBA isn't interpreted as much as you may think. It still gets compiled, but on a method by method basis when it's needed.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups