Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a xls file with Excel in VB

Tags:

excel

vb.net

So, how can I tell the system to open the file for me? I've tried

Shell(ExcelFilePath)

But an exception was thrown although the file path is from OpenFileDialog.FileOk

So, I am trying to play with Excel.Application, is it possible to open the file with that?

like image 562
Shane Hsu Avatar asked Jan 24 '13 08:01

Shane Hsu


2 Answers

This will open the file with Excel:

Process.Start("EXCEL.EXE", """C:\Folder\file.xls""")

Being the second string the arguments for the process. See the MSDN Dcoumentation.

like image 158
SysDragon Avatar answered Nov 15 '22 10:11

SysDragon


try this

System.Diagnostics.Process.Start("FilePath")

it will open the file in an application associated with it.

like image 41
Arpit Avatar answered Nov 15 '22 10:11

Arpit