我的问题是我无法使用西里尔语语言处理数值,我曾经遇到过在源代码中显示奇怪字符的问题,但我在切换字体时修复了它。我有一个工作表,其中包含具有西里尔字母值的单元格,我必须得到thoses值,然后与另一个工作表中的值进行比较。问题是,当我运行宏时,我得到了 "运行时错误1004:应用程序定义或对象定义错误",并且调试器中的变量包含???? ..我安装了保加利亚语言包(西里尔语)并设置为默认值,我的笔记本电脑也安装了它。我该怎么做才能解决问题。
以下是代码:
ThisWorkbook.Worksheets(1).Name = getOfferNum(s_sheet2)
Private Function getValue(ByVal s_sheet As String, ByVal cell, Optional ByVal wb As Workbook) As String
If wb Is Nothing Then
Set wb = ThisWorkbook
End If
If IsError(wb) Or cell = "" Or s_sheet = "" Then
getValue = "#Error"
ElseIf IsError(wb.Worksheets(s_sheet).Range(cell)) Then
getValue = "#Error"
ElseIf IsError(wb.Worksheets(s_sheet).Range(cell).Value) Then
getValue = "#Error"
Else
getValue = wb.Worksheets(s_sheet).Range(cell).Value
End If
End Function
Private Function getOfferNum(ByVal sheet As String) As String
Dim s_offerNum As String 'Number extracted from A3
s_offertNum = " "
Dim b_AddChar As Boolean ' Helps with the extracton from A3
b_AddChar = False
cellValue = getValue(sheet, "A2")
For i = 0 To Len(cellValue)
Dim s_test As String
s_test = Mid(cellValue, i + 1, 1)
If s_test = "¹" Then
b_AddChar = True
Else
If b_AddChar = True Then
s_offerNum = s_offerNum & s_test
End If
End If
Next i
getOfferNum = Mid(s_offerNum, 2, Len(s_offerNum))
End Function
cellValue =" ???????????? 1234"