如何从 Excel 中删除所有表情符号

如何从 Excel 中删除所有表情符号

我有一张 Excel 表,想使用“MySQL for Excel”功能将其导出到 MySQL。但是,我无法实现此功能,因为某些单元格包含表情符号,例如

答案1

如果你的表情符号是形状,那么在 Excel 中使用虚拟专用网络,运行这个简单的宏:

Sub dural()
    Dim sh As Shape

    If ActiveSheet.Shapes.Count <> 0 Then
        For Each sh In ActiveSheet.Shapes
            sh.Delete
        Next
    End If
End Sub

编辑#1:

如果表情符号文本,然后选择一个单元格并:

Sub kleanIt()
    Dim r As Range, v As Variant, L As Long
    Dim CH As String, i As Long, N As Long

    Set r = ActiveCell
    v = r.Value
    L = Len(v)

    For i = L To 1 Step -1
        CH = Mid(v, i, 1)
        N = AscW(CH)
        If N < 1 Or N > 256 Then
            v = Replace(v, CH, "")
        End If
    Next i

    r.Value = v
End Sub

相关内容