how to get Excel version in VB.NET

  • Thread starter Thread starter DavidB
  • Start date Start date
DavidB wrote: said:
how do I get Excel version in VB.NET??

Option Explicit On

Imports System.Runtime.InteropServices

Module Module1

Sub Main()
Dim excel As Object = CreateObject("Excel.Application")
Console.WriteLine(excel.Version)
Console.WriteLine(excel.Build)
Marshal.ReleaseComObject(excel)
System.GC.Collect()
End Sub

End Module

HTH
 
Tom,

Tom Shelton said:
how do I get Excel version in VB.NET??
[...]
Dim excel As Object = CreateObject("Excel.Application")
Console.WriteLine(excel.Version)
Console.WriteLine(excel.Build)
Marshal.ReleaseComObject(excel)
System.GC.Collect()
End Sub

.... which will work only if Excel is installed, so don't forget error
handling code if you don't have any knowledge about installed software.
 
Tom,

Tom Shelton said:
how do I get Excel version in VB.NET??
[...]
Dim excel As Object = CreateObject("Excel.Application")
Console.WriteLine(excel.Version)
Console.WriteLine(excel.Build)
Marshal.ReleaseComObject(excel)
System.GC.Collect()
End Sub

... which will work only if Excel is installed, so don't forget error
handling code if you don't have any knowledge about installed software.

True... I just showing the example :)
 
Herfried,

Do you have some code for when Excel is still in the box.
(I know what you wrote, however I show what I thought, reading your message
inline)

:-))

Cor
 

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

Back
Top