+ Reply to Thread
Results 1 to 11 of 11

Some machines requiring reference prefix such as VBA. for functions

  1. #1
    Registered User
    Join Date
    12-24-2009
    Location
    Tennesse, US
    MS-Off Ver
    Office 365
    Posts
    28

    Some machines requiring reference prefix such as VBA. for functions

    I have a workbook that I've been trying to make all the few changes to work with 32 and 64 bit Excel. Internally I have it working on both as long as the machines have .NET 3.5 and 4.8 loaded. I have a customer in Greece that seems to work on their 32bit machines but it is giving errors on their 64bit clients. When trying to compile it initially complained about a few FileSystemObject references which I changed from declaring a FileSystemObject to Scripting.FileSystemObject. Then I noticed it didn't like Date, which changing to VBA.Date resolved. Diving down the rabbit hole it seems to complain about every single reference of Date, UCase, UBound, LBound, Left, Right, Environ$ etc. With about 15k lines of code I surely don't want to be running these down one at a time. It appears all the same references are checked from the 32 to 64bit. Is there any easy way to remedy this? I even seen a solution for some of selecting UCMapi 1.0 Type Library but that didn't help either.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Some machines requiring reference prefix such as VBA. for functions

    it didn't like Date, which changing to VBA.Date resolved
    This is likely due to missing and/or mismatch of VBA Project library references. I've seen this happen couple of times when I wrote code in Excel 2016 and transferred file to Excel 2010 system.
    Fix is to change/add reference(s) missing.

    Check that the client doesn't have MS Office/Excel 16.0 selected (or missing), when they should have other version selected.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    12-24-2009
    Location
    Tennesse, US
    MS-Off Ver
    Office 365
    Posts
    28

    Re: Some machines requiring reference prefix such as VBA. for functions

    Quote Originally Posted by CK76 View Post
    This is likely due to missing and/or mismatch of VBA Project library references. I've seen this happen couple of times when I wrote code in Excel 2016 and transferred file to Excel 2010 system.
    Fix is to change/add reference(s) missing.

    Check that the client doesn't have MS Office/Excel 16.0 selected (or missing), when they should have other version selected.
    A mismatch I guess is possible. I tried un-selecting a few like the Microsoft Scripting Runtime and re-selecting but that didn't help. Here's a screen shot of the references selected. I can confirm what version of Office they are running. My 32bit excel is 16.0.11727.20222 and my 64bit is 16.0.12430.20198.

    Attachment 664873

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Some machines requiring reference prefix such as VBA. for functions

    Sorry, can't see your attachment.

    You may have to remote into their desktop and check if there are any missing references.

  5. #5
    Registered User
    Join Date
    12-24-2009
    Location
    Tennesse, US
    MS-Off Ver
    Office 365
    Posts
    28

    Re: Some machines requiring reference prefix such as VBA. for functions

    Quote Originally Posted by CK76 View Post
    Sorry, can't see your attachment.

    You may have to remote into their desktop and check if there are any missing references.
    That was the screen shot I was trying to attach. All the references are still checked off.

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Some machines requiring reference prefix such as VBA. for functions

    Hmm, if there is no missing reference...

    Only 2 other reasons that I can think of...
    1. Ambiguity created by using Date as variable, subname etc causing issue.
    2. MS Office installation was done as upgrade from previous version.

    In your case it is more likely to be 2. This is caused when update didn't complete cleanly and there are leftover from previous version (never have 2 versions of Office on the machine if it can be helped).
    First try Office Repair. If that doesn't work, uninstall and do clean install of MS Office.

  7. #7
    Registered User
    Join Date
    12-24-2009
    Location
    Tennesse, US
    MS-Off Ver
    Office 365
    Posts
    28

    Re: Some machines requiring reference prefix such as VBA. for functions

    Quote Originally Posted by CK76 View Post
    Hmm, if there is no missing reference...

    Only 2 other reasons that I can think of...
    1. Ambiguity created by using Date as variable, subname etc causing issue.
    2. MS Office installation was done as upgrade from previous version.

    In your case it is more likely to be 2. This is caused when update didn't complete cleanly and there are leftover from previous version (never have 2 versions of Office on the machine if it can be helped).
    First try Office Repair. If that doesn't work, uninstall and do clean install of MS Office.
    Thanks I'll have them try that.

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Some machines requiring reference prefix such as VBA. for functions

    What did you mean by "it seems to complain about every single reference of Date, UCase, UBound, " in your first post? If you got a "can't find project or library" error, then it's a reference problem as CK76 said.
    Rory

  9. #9
    Registered User
    Join Date
    12-24-2009
    Location
    Tennesse, US
    MS-Off Ver
    Office 365
    Posts
    28

    Re: Some machines requiring reference prefix such as VBA. for functions

    Quote Originally Posted by rorya View Post
    What did you mean by "it seems to complain about every single reference of Date, UCase, UBound, " in your first post? If you got a "can't find project or library" error, then it's a reference problem as CK76 said.
    Yes that was the error. It fails to compile for most things but the pieces required in the reference are there. I even tried to uncheck Visual Basic For Applications and recheck but once it's used you cannot uncheck it. I believe the other one used for FileSystemObject is Microsoft Scripting Runtime which was also still selected. Since it works on the 32bit machines it makes sense that maybe there's something with the install of the 64bit clients.

  10. #10
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Some machines requiring reference prefix such as VBA. for functions

    You should probably look into late binding so that you don’t need to worry about reference compatibility.

  11. #11
    Registered User
    Join Date
    12-24-2009
    Location
    Tennesse, US
    MS-Off Ver
    Office 365
    Posts
    28

    Re: Some machines requiring reference prefix such as VBA. for functions

    Quote Originally Posted by rorya View Post
    You should probably look into late binding so that you don’t need to worry about reference compatibility.
    Thanks for the info on that. I did actually have to use the late version in several pieces, didn't know there was an early vs late just saw that some environments seems to work better using late so I'll keep that in mind going forward.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] add prefix to number based on validation from other data if found prefix 0, do nothing
    By oeyandyprawira in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2018, 11:52 AM
  2. [SOLVED] Using a Cell as Reference with possible prefix/suffix
    By Simon3 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-17-2015, 08:52 PM
  3. [SOLVED] How to Stop Macro From Requiring File Open Prompt When Changing External WB Reference?
    By justinbelkin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-16-2013, 02:34 PM
  4. Cross reference requiring a complex output
    By kosh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-05-2012, 10:07 AM
  5. Calling Personal.xls functions without needing a 'personal.xls!' prefix
    By Skywalker in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-08-2010, 02:43 AM
  6. Replace one prefix with another prefix
    By uglyduck in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-23-2010, 08:24 PM
  7. Reference Functions
    By buddrenaud in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-20-2007, 06:58 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1