Загрузка данных


Sub AddFourHoursFixed()
    Dim rng As Range
    Dim origTime As Date
    Dim newTime As Date
    Dim textTime As String
    
    Set rng = ActiveDocument.Content
    
    With rng.Find
        .ClearFormatting
        .Text = "[0-9]{1;2}:[0-9]{2}"
        .MatchWildcards = True
        .Forward = True
        .Wrap = wdFindStop
        
        Do While .Execute
            textTime = rng.Text
            
            If IsDate(textTime) Then
                origTime = CDate(textTime)

                newTime = DateAdd("h", 4, origTime)
                

                rng.Text = Format(newTime, "HH:mm")
            End If
            

            rng.Collapse wdCollapseEnd
        Loop
    End With
    
    MsgBox "Обработка завершена!", vbInformation, "Готово"
End Sub