I am creating a excel application in VB.net using VisualStudio 2008.
while adding reference Microsoft.office.interop.excel we have both managed ( On the .NET TAB) and unmanaged (on the COM TAB).
currently i am referencing the COM tab but it is not showing the errors properly.
can i use the excel interop on .NET tab?
which one is the better way to reference and what is the difference between those two?
Yes, do use the .NET
interop library to create the namespace 'Microsoft.Office.Interop.Excel'
Then define an application object with
Private app As Microsoft.Office.Interop.Excel.Application
and either a) connect to an a running Excel application with
app = CType(GetObject([Class]:="Excel.Application"), Microsoft.Office.Interop.Excel.Application)
or b) create a new Excel application with
app = CType(CreateObject(ProgId:="Excel.Application"), Microsoft.Office.Interop.Excel.Application)
Good luck!
The .NET version of the Interop library is basically the COM component in a .NET wrapper. It is advisable to use the .NET implementation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.