简体   繁体   English

我在一台计算机上收到来自VBA的类型不匹配错误,但在其他计算机上却没有。 为什么?

[英]I receive a type-mismatch error from VBA on one computer, but not on others. Why?

I have an Excel file with macro. 我有一个带有宏的Excel文件。 In this file, there is a user form. 在此文件中,有一个用户表单。 In the form, there is a Textbox. 在表单中,有一个文本框。 I call the user form "MyForm" and the TextBox "MyTextBox". 我将用户窗体称为“ MyForm”,将文本框称为“ MyTextBox”。

I also have a module. 我也有一个模块。 In this module there is a subroutine like this 在这个模块中有一个像这样的子程序

Sub MySub(s As String)
    MyForm.MyTextBox.Value = s
    ...
End Sub

On most computers, the code above has no problem, while on one computer, it raises the type mismatch error. 在大多数计算机上,上面的代码没有问题,而在一台计算机上,它会引发类型不匹配错误。 Can you explain this? 你能解释一下吗?

Please help me. 请帮我。 I'm very frustated. 我很沮丧

Many thanks in advance, 提前谢谢了,

Haris 哈里斯

Some things you could check (most of them obvious, I know). 您可以检查一些事情(我知道其中大多数是显而易见的)。

-Versions of the spreadsheet between the various PCs. -各种PC之间的电子表格版本。
-Culture on the problem PC -问题电脑上的文化
-Data on the problem PC -问题电脑上的数据
-The form being used with other forms/macros who also have a variable defined as "s" -与其他表单/宏一起使用的表单,这些表单/宏也具有定义为“ s”的变量

What kind of data is usually entered into the textbox? 通常会在文本框中输入哪种数据?

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

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