找不到与嵌入类型匹配的interlop类型''你缺少一个程序集引用...错误

时间:2016-04-06 03:21:10

标签: vb.net

这是我的代码:

Imports System.Windows.Forms

导入Microsoft.Office.Tools.Word 导入Microsoft.Office.Interop.Word

Public Class Form1

'Imports Microsoft.Office.Interop.Word
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    Dim openfile As OpenFileDialog = New OpenFileDialog()

    If openfile.ShowDialog() Then
        Dim file As String = openfile.FileName
        Dim outfile As String = "C:\\file.pdf"
        Dim extension As String = System.IO.Path.GetExtension(file)
        If extension = ".doc" Or extension = ".docx" Then
            Dim app As Microsoft.Office.Interop.Word.Application = New Microsoft.Office.Interop.Word.Application()
            Dim doc As Microsoft.Office.Tools.Word.Document = Nothing
            doc = app.Documents.Open(file, Type.Missing, False)
            doc.ExportAsFixedFormat(outfile, Word.WdExportFormat.wdExportFormatPDF)
            doc.Close(False, Type.Missing, Type.Missing)
            app.Quit(False, False, False)
            System.Runtime.InteropServices.Marshal.ReleaseComObject(app)


        End If
    End If
End Sub

结束班

我正在尝试制作一个有adobe pdf阅读器的程序,你打开一个word文件,然后转换为pdf并在阅读器中显示。

但我收到此错误:找不到与嵌入类型匹配的interlop类型''你错过了程序集引用...错误。我把embl interlop类型设置为false。我不知道该怎么做。请帮忙。

提前致谢。

  • 我研究了很多,但我找不到任何东西,所以我来到这里。

0 个答案:

没有答案