I am trying to open word document from the excel but stuck at the first line when I am using the below code. I have added reference still get the compile error user- defined type not defined.
Dim oApp As Word.Application
Dim oSec As Word.Section
Dim oDoc As Word.Document
Set AppWord = CreateObject("Word.Application")
Set oApp = New Word.Application
Set oDoc = oApp.Documents.Add