code for excel to word

Submitted by techrev on Mon, 01/22/2018 - 09:45

Add below code (for button)

Private Sub CommandButton1_Click()

Dim objExcel As New Excel.Application

Dim exWb As Excel.Workbook

Set exWb = objExcel.Workbooks.Open("d:\excel.xlsx")

ThisDocument.prjno.Caption = exWb.Sheets("Sheet1").Cells(6, 2)

exWb.Close

Set exWb = Nothing

End Sub