Wednesday 10 July 2013

VB.NET - How to fix error - Type 'XlFixedFormatQuality' is not defined.


Watch this example on YouTube:


The following code will produce error
        Dim eApplication As ApplicationClass = New ApplicationClass()
        Dim eWorkbook As Workbook = Nothing

        Dim paramExportFilePath As String = "C:\Temp\test.pdf"
        Dim paramExportFormat As XlFixedFormatType = _
            XlFixedFormatType.xlTypePDF
        Dim paramExportQuality As XlFixedFormatQuality = _
            XlFixedFormatQuality.xlQualityMinimum '.xlQualityStandard

Type 'XlFixedFormatType' is not defined.
Type 'XlFixedFormatQuality' is not defined.

To fix it
- Remove existing (old) version of Interop.Excel






- Add new one












- next right click reference in solution explorer and select properties

Ensure that Embed Interop Types is set to False.




No comments:

Post a Comment