Cannot access VBProject object

A

Adam

I wanted to remove a VBA Form in a Word template. The following is the code.
I have set the Word application property of "Trust Access from Visual Basic
Project", but it seems that the VBProject object I got is somehow invalid.
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
 
A

Adam

I figured out that the referenced "Microsoft.Vbe.Interop.dll" is of version
10 but my GAC is with 11.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top