If you haven't already done so, you may want to try adding a reference to Microsoft Excel 9.0 Object Library (Project > Add Reference > COM) or you can declare each as objects (e.g. Dim xl as Object) without adding the reference.
Cheers, Chris
: This might sound easy to answer but I am getting a Type is Not declared Error for: : Dim xl As Excel.Application : Dim myWorkbook As Excel.Workbook : : Am I suppose to import a namespace? Am I missing a something? : : Thanks. :
: This might sound easy to answer but I am getting a Type is Not declared Error for: : Dim xl As Excel.Application : Dim myWorkbook As Excel.Workbook : : Am I suppose to import a namespace? Am I missing a something? : : Thanks. : You have to add a reference to Excel. You'll see it on the com tab. You'll get a namespace from com interop.
: : This might sound easy to answer but I am getting a Type is Not declared Error for: : : Dim xl As Excel.Application : : Dim myWorkbook As Excel.Workbook : : : : Am I suppose to import a namespace? Am I missing a something? : : : : Thanks. : : : You have to add a reference to Excel. You'll see it on the com tab. You'll get a namespace from com interop. : : -ray :
you are probably missing reference to Excel Automation library. But I recommend you to stop working with Excel Interop, it has a lot of problems. One major problem is if there are different versions of Excel installed in development and production environment - then everything falls apart.
Comments
If you haven't already done so, you may want to try adding a reference to Microsoft Excel 9.0 Object Library (Project > Add Reference > COM)
or you can declare each as objects (e.g. Dim xl as Object) without adding the reference.
Cheers,
Chris
: This might sound easy to answer but I am getting a Type is Not declared Error for:
: Dim xl As Excel.Application
: Dim myWorkbook As Excel.Workbook
:
: Am I suppose to import a namespace? Am I missing a something?
:
: Thanks.
:
: Dim xl As Excel.Application
: Dim myWorkbook As Excel.Workbook
:
: Am I suppose to import a namespace? Am I missing a something?
:
: Thanks.
:
You have to add a reference to Excel. You'll see it on the com tab. You'll get a namespace from com interop.
-ray
: : Dim xl As Excel.Application
: : Dim myWorkbook As Excel.Workbook
: :
: : Am I suppose to import a namespace? Am I missing a something?
: :
: : Thanks.
: :
: You have to add a reference to Excel. You'll see it on the com tab. You'll get a namespace from com interop.
:
: -ray
:
Thanks Chris and Ray :-)
Dan
you are probably missing reference to Excel Automation library.
But I recommend you to stop working with Excel Interop, it has a lot of problems. One major problem is if there are different versions of Excel installed in development and production environment - then everything falls apart.
For [link=http://www.gemboxsoftware.com/GBSpreadsheet.htm]Excel C#[/link] and [link=http://www.gemboxsoftware.com/GBSpreadsheet.htm]Excel VB.NET[/link] applications I use GemBox.Spreadsheet [link=http://www.gemboxsoftware.com/GBSpreadsheet.htm].NET Excel[/link] component.
Much more easier to use and much more faster that Excel Interop.
[link=https://www.kellermansoftware.com/p-52-excel-reports.aspx] https://www.kellermansoftware.com/p-52-excel-reports.aspx[/link]
[link=https://www.kellermansoftware.com/p-52-excel-reports.aspx]https://www.kellermansoftware.com/p-52-excel-reports.aspx[/link]