简体   繁体   中英

VBA - "FORMAT" function isn't recongnised on 1 computer

I've coded something in VBA to help my co-workers and it's working on 8 computers but on this one computer, everytime I try to start the code, it gives me an error.

Sorry I'm translating from French into English but the error is:

Compilation error: Project or library isn't found

The actual code is:

'           ============================================
'           === TRAITEMENT DES PRODUITS DU GROUPE 10 ===
'           ========== FOURNISSEURS STANDARDS ==========
'           ============================================
            Case 10
            Select Case var_Prix
                Case Is < 25
                    Range(COLLISTE & var_Ligne).Value = Format(99999, "#,####0.0000")
                    Range(COLPRIX2 & var_Ligne).Value = Format(var_Prix / (0.5 - TRANSPORT), "#,####0.0000")
                    Range(COLPRIX3 & var_Ligne).Value = Format(var_Prix / (0.52 - TRANSPORT), "#,####0.0000")
                    Range(COLPRIX4 & var_Ligne).Value = Format(var_Prix / (0.55 - TRANSPORT), "#,####0.0000")
                    Range(COLPRIX5 & var_Ligne).Value = Format(var_Prix / (0.6 - TRANSPORT), "#,####0.0000")
<the code continues>

and it has Format highlighted. Seems like the "Format library" isn't installed but I've tried Google and apparently "Format" is installed with windows or office.

As JKP asked, are there any references marked as "missing"? A missing Ref can cause unpredictable behaviour in other referenced libraries. As a temporary solution, try forcing the reference by putting VBA. before the format, like = VBA.Format(99999, "#,####0.0000") This normally works.

Had this issue recently. Cause was 'something' had disabled the "Analysis Toolpack - VBA" Add-in.

so just had this issue. The solution we found was to add Microsoft Scripting Runtime and Microsoft Word 16.0 Object Library back to the References - VBA Project selection. Not sure which one actually fixed it. But both made the rest of my file work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM