Hi,
I have an excel file,having lot or micros, connecting to database, doing some complex calculation..inshot that excel file is itself an application.
Now I want to open that excel in VB.net form, on button click. I prefer to open that excel in vb.net form itself having all the excel tool bar etc, If that is not possible then opening in separate window using excel will also solve my purpose (coz when we open in excel it self we will get all the toolbar option etc automatically)
Please Help
Anurag

No reply from any one here ..but i found the solution from other sources..

To open in vb form :
1) Add com component "Microsoft Web browser" [by right click on toolbox select add/remove item]

2) You will get a new tool "Microsoft Web Browser"

3) Drag control to your form

4) Write this line on some button click or form load

AxWebBrowser1.Navigate("C:\test1.xls")

However opening file in form using webbrowser is giving me some problem as my excel sheet is having VBA code, but for normal excel file it will work.

Alternate way is, open in separate window using excel:
Method 1=>

Imports System.Diagnostics
Dim ps As New ProcessStartInfo
ps.UseShellExecute = True
ps.FileName = "C:\test1.xls"
Process.Start(ps)

Method 2=>
Add Microsoft excel 10.0 as reference

Imports Excel.WorkbookClass
Imports Excel.WorksheetClass
Imports Excel.ApplicationClass

Dim xlsApp As Excel.ApplicationClass
Dim xlsWB As Excel.WorkbookClass
Dim xlsSheet As Excel.WorksheetClass
xlsApp = New Excel.ApplicationClass
xlsApp.Visible = True
xlsWB = xlsApp.Workbooks.Open("C:\test1.xls")

Enjoy!!
anurag_shr

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.