Type mismatch on one PC but not other - run time e

2019-09-12 06:11发布

I have a fairly simple macro that populates a variant array with both text and numbers. It works fine on my PC but not on my brothers, who's PC is new (using the same file/macro). I have checked the excel versions and they are the same (2016 MSO 16.0.7571.7095) 32 bit, also the culture is the same - 1033 for both. The error is run time 13 - Type mismatch. The windows are different though, 8.1 vs 10 - could it be that?

This is the only proper post I could find on the topic: I receive a type-mismatch error from VBA on one computer, but not on others. Why?

This is the code line on which the error is created:

    prArray(i, 1) = CDbl(Mid(prArray(i, O), 11, 7))

I am stuck. Any help would be much appreciated. Thanks

标签: excel vba
1条回答
男人必须洒脱
2楼-- · 2019-09-12 06:39

After some frustration it is an easy fix after all, and comes down to "Culture on the problem PC" as answered here: I receive a type-mismatch error from VBA on one computer, but not on others. Why? . For interest, I checked the excel culture/language with this code:

Sub Detect_Language()
  MsgBox Application.LanguageSettings.LanguageID(msoLanguageIDUI)
End Sub

All that was necessary was to change the language settings of the PC itself at Control Panel > Clock, Language and Region > Language, to US English (it was different at the problem PC).

查看更多
登录 后发表回答