简体   繁体   English

VBA - “格式” function 未在 1 台计算机上识别

[英]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.我在 VBA 中编写了一些代码来帮助我的同事,它可以在 8 台计算机上运行,但是在这台计算机上,每次我尝试启动代码时,都会出现错误。

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.似乎没有安装“格式库”,但我试过谷歌,显然“格式”是用 windows 或办公室安装的。

As JKP asked, are there any references marked as "missing"?正如 JKP 所问,是否有任何参考文献标记为“缺失”? A missing Ref can cause unpredictable behaviour in other referenced libraries.缺少 Ref 可能会导致其他引用库出现不可预测的行为。 As a temporary solution, try forcing the reference by putting VBA.作为临时解决方案,尝试通过放置 VBA 来强制引用。 before the format, like = VBA.Format(99999, "#,####0.0000") This normally works.在格式之前,如 = VBA.Format(99999, "#,####0.0000") 这通常有效。

Had this issue recently.最近有这个问题。 Cause was 'something' had disabled the "Analysis Toolpack - VBA" Add-in.原因是“某些东西”禁用了“分析工具包 - VBA”加载项。

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.我们找到的解决方案是将 Microsoft Scripting Runtime 和 Microsoft Word 16.0 Object 库添加回参考 - VBA 项目选择。 Not sure which one actually fixed it.不确定是哪一个真正修复了它。 But both made the rest of my file work.但两者都使我的文件的 rest 工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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