wps宏运行时错误13类型不匹配 - 爱问答

(爱问答)

wps宏运行时错误13类型不匹配

wps宏运行时错误13 类型不匹配

Sub AAA()
    Dim dic As New Dictionary
    Dim dicT As New Dictionary
    With Sheet1
        ER1 = .Range("A" & .Rows.Count).End(3).Row
        If ER1 <= 1 Then
            MsgBox "没有关键词!"
            Exit Sub
        End If
        arr = .Range("A1").Resize(ER1).Value
        For i = 2 To UBound(arr)
            temp = Trim(LCase(arr(i, 1)))
            If InStr(temp, " ") <= 0 Then
                dic(temp) = 1
            Else
                dicT(" " & temp & " ") = 1
            End If
        Next
        arrKS = dicT.Keys
 
        dicT.RemoveAll
        er2 = .Range("B" & .Rows.Count).End(3).Row
        For i = 2 To er2
            temp = .Range("B" & i).Value
            If temp <> "" Then
                dicT(temp) = 1
            End If
        Next
        If dicT.Count > 0 Then
            arrWS = dicT.Keys
        Else
            MsgBox "请填入替换内容所在表名!"
            Exit Sub
        End If
 
        dicT.RemoveAll
        er3 = .Range("C" & .Rows.Count).End(3).Row
        For i = 2 To er3
            temp = .Range("C" & i).Value
            If temp <> "" Then
                dicT(temp) = 1
            End If
        Next
        If dicT.Count > 0 Then
            arrCol = dicT.Keys
        Else
            MsgBox "请填入替换内容所在列名!"
            Exit Sub
        End If
    End With
 
    With Application.FileDialog(msoFileDialogOpen)
        .InitialFileName = ThisWorkbook.Path
        .AllowMultiSelect = False
        .Title = "选择处理文件"
        .Filters.Clear
        .Filters.Add "xlsx文件", "*.xlsx"
        .Filters.Add "所有文件", "*.*"
        If .Show = -1 Then
            strFName = .SelectedItems.Item(1)
            PFile strFName, dic, arrKS, arrWS, arrCol
        End If
    End With
 
End Sub
 
Sub PFile(strFName, dic As Dictionary, arrKS, arrWS, arrCol)
    Application.ScreenUpdating = False
    Dim wb As Workbook
    Dim ws As Worksheet
'    Set wb = Workbooks.Open(strFName)
    Set wb = FindWorkbook(strFName)
    If wb Is Nothing Then
        MsgBox FNameTemp & "_文件打开失败!"
        Exit Sub
    End If
 
    For i = 0 To 0 'UBound(arrWS)
        Set ws = FindWS(wb, arrWS(i))
        If ws Is Nothing Then
            strMsg = wb.Name & " _ " & "未找到[" & arrWS(i) & "]表"
            MsgBox strMsg
            GoTo line1
        End If
        Dim strWSName As String
        strWSName = ws.Name
 
        CN = UBound(arrCol)
        Dim arrCI()
        ReDim arrCI(0 To CN)
        For ii = 0 To CN
            strColName = arrCol(ii)
            colN = FindCol(ws, strColName)
            If colN = 0 Then
                strMsg = ws.Parent.Name & " _ " & "未找到[" & strColName & "]列"
                MsgBox strMsg
                GoTo line1
            End If
            arrCI(ii) = colN
        Next
        For ii = 0 To CN
            PX1 ws, arrCI(ii), dic, arrKS
        Next
    Next

Dim dic As New Dictionary

这个自定义类型你没有定义,程序无法运行。所以,你上传的代码不全。

仅仅这一句来说,

temp = Trim(LCase(arr(i, 1)))

没有问题。


相关标签:wps

下一篇:美中幼儿园硬件条件如何?

上一篇:excel公式,我想让我的四组数值中,任意两组是相同的数值就OK,如果四个数值都不同的话,就标识出来

热门标签:
excel 网盘 破解 word dll
最新更新:
微软重新评估新的Outlook的使用时机 联想推出搭载联发科Helio G80芯片组的Tab M9平板 英特尔创新大赛时间确定! 微软Edge浏览器在稳定渠道中推出Workspaces功能 英伟达RTX4060TiGPU推出MaxSun动漫主题! 谷歌地图为用户提供了街景服务! GameSir 在T4 Kaleid中推出了一款出色的控制器! 微软开始在Windows 11 中测试其画图应用程序的新深色模式! LG电子推出全球首款无线OLED电视 英伟达人工智能芯片崭露头角! Steam Deck可以玩什么游戏-Steam Deck价格限时优惠 雷蛇推出CobraPro鼠标 Kindle电子阅读器可以访问谷歌商店吗 Windows10如何加入组策略 window10图片查看器怎么没有了?