EXCEL用ADO打开后看到$print_area和$_分别代表什么?$print_area我知道是打印区域,而这个$_是什么?$_这个如何取消不会在ADO显示后看到?ADO打不开这两种如何批量修改多个EXCEL 将这两种删除能否用VBS来做 如何写?

解决方案 »

  1.   

    你可以循环一下工作簿,调用下面的清除宏。
    Sub ClearNames()
    ' 用于清除当前工作簿中的名称定义
    ' 2008-04-23 Tiger_Zhao    Dim reservedNames() '保留的名称定义(打印区域、打印标题)
        reservedNames = Array("*!Print_Area", "*!Print_Titles")
        
        Dim allNames As Names
        Set allNames = ActiveWorkbook.Names
        
        Dim lCountBefore As Long
        lCountBefore = allNames.Count
        
        Dim i As Long, j As Long
        i = 1
        While i <= allNames.Count
            For j = 0 To UBound(reservedNames)
                If Names(i).Name Like reservedNames(j) Then
                    Debug.Print "Reserved:", Names(i).Name & Names(i).Value
                    i = i + 1
                    GoTo NextName
                End If
            Next
            
            Names(i).Delete
    NextName:
        Wend
        
        MsgBox "完成名称定义的清除:" & vbCrLf & _
               "清除前 " & lCountBefore & " 个," & vbCrLf & _
               "清除后 " & allNames.Count & " 个。", _
               vbInformation
    End Sub