Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Apr 2013
    Posts
    14
    Thanks
    5
    Thanked 0 Times in 0 Posts

    VBA 7.0 bug (32 bit)?

    Hi all,
    I'm having a weird problem that I think may be a VBA bug. I have a function that takes two strings as parameters. On my machine it runs fine. On another guy's machine it sometimes runs, other times the parameters come into the function empty (not when run sequentially, but across reboots). I used VarType to test the parameter in the function and the times it fails it is vbEmpty vs. vbString. If I go up the call stack, the variables are fine when they are passed into the function.

    The only thing I can think of is a VBA bug, I am on Version 1625 and he is on Version 1590. I'm poking around on Technet trying to find something that talks about the differences between the two versions but no luck so far.

    1590 is the standard corporate version, as I recall I had a problem with Project macros that had a fix in the (at the time) current version so IT upgraded my machine. This is part of why I think it is a VBA problem. Any suggestions on how I might work around this? Only reliable thing I can think of is to pull the code from the function and embed it where ever it is called. I'd like to find a work around since there are potentially a number of users who would have to be upgraded.

    Thanks,
    Eric

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    860
    Thanks
    0
    Thanked 10 Times in 9 Posts
    I had a similar situation with a VBA code that was originally written in Word 2003. When I ran the code in Word 2010, sometimes I achieved the desired results, other times I did not. The problem was that all variables (two strings in the function, and two variables that I pass to the function) were not explicitly declared as strings. Are you sure that vbString is not the sub-type of a variant? That's what my problem turned out to be.

  4. #3
    New Lounger
    Join Date
    Apr 2013
    Posts
    14
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Hi,
    I use DefStr S for all my strings and the variables that are being passed start with s. I also explicitly put "as string" in the Dim for the variables and in the function parameter list (redundant with the DefStr) and it still didn't work...

    Thanks for the comment,
    Eric

Posting Permissions

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