A
Adam
I wanted to remove a VBA Form in a Word template via VB programming. The
following is the code. I have set the Word property of "Trust Access from
Visual Basic Project", but it seems that the VBProject object I got is
somehow invalid. Thanks in advance for any help!
Dim wordApp As Microsoft.Office.Interop.Word.Application
Dim doc As Microsoft.Office.Interop.Word.Document
Dim vbProj As Microsoft.Vbe.Interop.VBProject
Dim name As String
wordApp = New Microsoft.Office.Interop.Word.Application
doc = wordApp.Documents.Open(FileName:="C:\\Temp\\Test.dot")
vbProj = doc.VBProject
name = vbProj.Name //This line throws exception
following is the code. I have set the Word property of "Trust Access from
Visual Basic Project", but it seems that the VBProject object I got is
somehow invalid. Thanks in advance for any help!
Dim wordApp As Microsoft.Office.Interop.Word.Application
Dim doc As Microsoft.Office.Interop.Word.Document
Dim vbProj As Microsoft.Vbe.Interop.VBProject
Dim name As String
wordApp = New Microsoft.Office.Interop.Word.Application
doc = wordApp.Documents.Open(FileName:="C:\\Temp\\Test.dot")
vbProj = doc.VBProject
name = vbProj.Name //This line throws exception