.doc文件批量转换为.txt的更新方法

时间:2018-11-26 20:50:38

标签: vb.net

我正在尝试创建一个将.doc文件批量转换为.txt的应用程序。我已经建议修改了代码以解决错误,但是它仍然不会拉起浏览器框(允许选择目录)。

Module Module1
    Sub ConvertDocumentsToTxt()
        'Updated by Extendoffice 20181123
        Dim xIndex As Long
        Dim xFolder As Object
        Dim xFileStr As String
        Dim xFilePath As String
        Dim xDlg As FileDialog
        Dim xActPath As String
        Dim xDoc As XDocument
        Dim ScreenUpdating As Boolean
        ScreenUpdating = False
        xDlg = FileDialog(msoFileDialogFolderPicker)
        If xDlg.ShowDialog <> -1 Then Exit Sub
        xFolder = SelectedItems(1)
        xFileStr = Dir(xFolder & "\*.doc")
        Dim ActiveDocument As Object = Nothing
        xActPath = ActiveDocument.Path
        While xFileStr <> ""
            xFilePath = xFolder & "\" & xFileStr
            If xFilePath <> xActPath Then
                Dim Documents As Object = Nothing
                xDoc = Documents.Open(xFilePath, AddToRecentFiles:=False, Visible:=False)
                xIndex = InStrRev(xFilePath, ".")
                Debug.Print(Left(xFilePath, xIndex - 1) & ".txt")
                Dim wdFormatText As Object = Nothing
                SaveFileDialog(Left(xFilePath, xIndex - 1) & ".txt", FileFormat:=wdFormatText, AddToRecentFiles:=False)
            End If
        End While
        xFileStr = Dir()
        ScreenUpdating = True
    End Sub

    Private Sub SaveFileDialog(v As String, FileFormat As Object, AddToRecentFiles As Boolean)
        Throw New NotImplementedException()
    End Sub

    Private ReadOnly Property SelectedItems(v As Integer) As Object
        Get
            Throw New NotImplementedException()
        End Get
    End Property

    Private ReadOnly Property FileDialog(msoFileDialogFolderPicker As Object) As FileDialog
        Get
            Throw New NotImplementedException()
        End Get
    End Property

    Public Property msoFileDialogFolderPicker As Object
End Module

0 个答案:

没有答案