在vbs中,如何关闭Microsoft Word中的导航窗口?

时间:2013-11-25 21:28:36

标签: vba vbscript

我有一个脚本,然后排序并删除我不需要的表。我发现导航窗口打开时脚本减速为空。 我已经尝试了很多,我需要一段时间来列出。谷歌没什么希望。

编辑:这是我用来对表格进行排序的代码的基本版本。我试图尽可能地清理垃圾。该代码适用于排序表,我只想知道如何关闭WORD中的导航窗口。

    For Each oTable In objDoc.Tables

    Table.innerHTML = "On Table " & Tablenum & " of " & TotalTables
    If oTable.Columns.Count = 2 Then
        oTable.Cell(1,1).Select
        Set rng = objSelection
        If objSelection.Information(wdWithInTable) Then
            If Instr(1,rng, "SRS_",1 ) > 0 Then
                For row = 0 to oTable.Rows.Count
                    rowcount = oTable.Rows.Count
                    Dim SrsTag
                    Dim deleteit
                    oTable.Cell(row,1).Select
                    Set rng = objSelection
                    If Instr(1,rng, "SRS_",1 ) > 0 Then
                        objSelection.Cells(1).Range.Select
                        strTag = objSelection
                        strTag = Replace(strTag," ","")
                        strTag = Replace(strTag,vbCr," ")
                        strTag = Replace(strTag,vbLf," ")
                        strTagarr = Split(strTag)
                        SrsTag = strTagarr(0)
                        If UBound(strTagarr) > 1 Then
                            deleteit = True
                            For airframe = 1 To UBound(strTagarr)
                                If Instr(1,strTagarr(airframe), Frame, 1 ) > 0 And len(strTag) > 1 And strTag <> " " Then
                                    deleteit = False
                                End If
                            Next
                        Else
                            deleteit = False
                        End If
                        If deleteit = True Then
                            objSelection.Rows.Delete
                            rowcount = rowcount - 1
                            If (rowcount = 0) Then
                                TableCount = TableCount - 1
                                Exit For
                            Else
                                row = row - 1
                            End If
                        Else
                            objSelection.TypeText(SrsTag)
                        End If
                    End If
                Next
            Else
                objSelection.Move
            End If
        End If
    End If
Next

2 个答案:

答案 0 :(得分:2)

您可以添加

CommandBars("Navigation").Visible = False

答案 1 :(得分:0)

ActiveWindow.DocumentMap = False