Переносит данные из Excel в Word.
Sub Экспорт_В_Docx()
Dim objWrdApp As Object, objWrdDoc As Object
Dim pathS As String, IsAppClose As Boolean
Application.ScreenUpdating = False
On Error Resume Next
Set objWrdApp = GetObject(, "Word.Application")
If objWrdApp Is Nothing Then
Set objWrdApp = CreateObject("Word.Application")
IsAppClose = True
'objWrdApp.Visible = True
End If
On Error GoTo 0
If objWrdApp Is Nothing Then
MsgBox "Не удалось подключиться к Word"
Application.ScreenUpdating = True
Exit Sub
End If
Set objWrdDoc = objWrdApp.Documents.Add
Sheets("Лист1").UsedRange.Copy
objWrdDoc.Range(0).Paste
pathS = "D:\"
objWrdDoc.SaveAs pathS & "Файл1 " & Format(Now(), "DD.MM.YYYY hh.mm.ss") & ".docx"
objWrdDoc.Close False
If IsAppClose Then
objWrdApp.Quit
End If
Set objWrdDoc = Nothing: Set objWrdApp = Nothing
Application.ScreenUpdating = True
Application.CutCopyMode = False
End Sub