Consulting

Results 1 to 2 of 2

Thread: Process indicator in a script

  1. #1

    Process indicator in a script

    Hi,

    I create a script for comparing several versions of same documents in a folder. The script allows to create new reports with results.

    Private Sub SummaryReportButton_Click()
        Dim objDocA As Word.Document
        Dim objDocB As Word.Document
        Dim objDocC As Word.Document
        
        Dim objFSO As Scripting.FileSystemObject
        Dim objFolderA As Scripting.Folder
        Dim objFolderB As Scripting.Folder
        Dim objFolderC As Scripting.Folder
        
        Dim colFilesA As Scripting.Files
        Dim objFileA As Scripting.File
        
        Dim i As Integer
        Dim j As Integer
        
        Set objFSO = New FileSystemObject
        Set objFolderA = objFSO.GetFolder(ChooseFolder("Choose the folder with the original documents", ThisDocument.Path))
        Set objFolderB = objFSO.GetFolder(ChooseFolder("Choose the folder with revised documents", ThisDocument.Path))
        Set objFolderC = objFSO.GetFolder(ChooseFolder("Choose the folder for the comparisons documents", ThisDocument.Path))
        
        Set colFilesA = objFolderA.Files
        
        For Each objFileA In colFilesA
        If objFileA.Name Like "*.docx" Then
            Set objDocA = Documents.Open(objFolderA.Path & "\" & objFileA.Name)
            Set objDocB = Documents.Open(objFolderB.Path & "\" & objFileA.Name)
            Set objDocC = Application.CompareDocuments( _
                OriginalDocument:=objDocA, _
                RevisedDocument:=objDocB, _
                Destination:=wdCompareDestinationNew)
            objDocA.Close
            objDocB.Close
            On Error Resume Next
            Kill objFolderC.Path & "\" & objFileA.Name
            On Error GoTo 0
            objDocC.SaveAs FileName:=objFolderC.Path & "\" & objFileA.Name
            objDocC.Close SaveChanges:=False
        End If
        Next objFileA
        
    End Sub

    I would like to add a process indicator until that the task is finished. Could you please help me to implement that?

    Many thanks in advance for your help.

    Regards

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Cross-posted at: https://www.excelforum.com/word-prog...indicator.html
    Please read VBA Express' policy on Cross-Posting in item 3 of the rules: http://www.vbaexpress.com/forum/faq...._new_faq_item3
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •