Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

After the reference is set, Word variables can be declared with the correct (Word) variable type

Sub WordEarlyBinding()     Dim wdApp As Word.Application     Dim wdDoc As Document     Set wdApp = New Word.Application     Set wdDoc = wdApp.Documents.Open(ThisWorkbook.Path & "\Word.docx")     wdApp.Visible = True     Set wdApp = Nothing     Set wdDoc = Nothing End Sub