Загрузка страницы

Auto Export Excel Data to MS Word Form

Easy way to populate MS word form using Excel table data.

main code :

Option Explicit
Const FilePath As String = "C:\Users\Acer-PC\Desktop\AUTOEXPORT\"
Dim wd As New Word.Application

Sub ExportButton()

Dim doc As Word.Document
wd.Visible = True

Dim Name As String
Dim Address As String

Name = ThisWorkbook.Sheets(1).Range("D5").Value 'value from sheet1
Address = ThisWorkbook.Sheets(1).Range("D6").Value

Set doc = wd.Documents.Open(FilePath & "output.docx")
Copy2word "NameField", Name
Copy2word "AddressField", Address

doc.Close

wd.Quit
'MsgBox "Created files in " & FilePath & "!"

End Sub
Sub Copy2word(BookMarkName As String, Text2Type As String)
'copy each cell to relevant Word bookmark
wd.Selection.GoTo What:=wdGoToBookmark, Name:=BookMarkName
wd.Selection.TypeText Text2Type
End Sub

Видео Auto Export Excel Data to MS Word Form канала Kamirul Kamirul
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
30 апреля 2018 г. 22:49:23
00:03:11
Яндекс.Метрика