RSS Forums RSS
Please support our VB.NET advertiser: Programming Forums
Views: 51596 | Replies: 8 | Solved
Reply
Join Date: Jul 2005
Posts: 2
Reputation: daskeyboard is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
daskeyboard daskeyboard is offline Offline
Newbie Poster

opening an Excel file in VB.NET

  #1  
Jul 26th, 2005
The title of this thread pretty much says it all - I would like to know how to open an already created excel spreadsheet (I want the application to launch).
Thanks so much to anyone who has time to respond to this.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Posts: 175
Reputation: Letscode is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 5
Letscode's Avatar
Letscode Letscode is offline Offline
Junior Poster

Re: opening an Excel file in VB.NET

  #2  
Jul 26th, 2005
Originally Posted by daskeyboard
The title of this thread pretty much says it all - I would like to know how to open an already created excel spreadsheet (I want the application to launch).
Thanks so much to anyone who has time to respond to this.


check out this article by Microsoft ,
http://support.microsoft.com/default.aspx?scid=kb%3B[LN]%3BQ316934

Copy and paste the URL in your browser
Save White Tiger
Reply With Quote  
Join Date: Jul 2005
Posts: 2
Reputation: daskeyboard is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
daskeyboard daskeyboard is offline Offline
Newbie Poster

Re: opening an Excel file in VB.NET

  #3  
Jul 27th, 2005
Anyone have another suggestion - the microsoft example is slightly prolix.
Reply With Quote  
Join Date: Aug 2005
Posts: 1
Reputation: Wolfskind is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
Wolfskind Wolfskind is offline Offline
Newbie Poster

Re: opening an Excel file in VB.NET

  #4  
Aug 2nd, 2005
Originally Posted by daskeyboard
Anyone have another suggestion - the microsoft example is slightly prolix.

Dim xlsApp As Excel.Application
Dim xlsWB As Excel.Workbook
Dim xlsSheet As Excel.Worksheet
Dim xlsCell As Excel.Range
Dim xlsDatei As String

xlsApp = New Excel.Application
xlsApp.Visible = True
xlsWB = xlsApp.Workbooks.Open(Path)
xlsSheet = xlsWB.Worksheets(1)
xlsCell = xlsSheet.Range("A1")

Greetings from Wolfskind
Reply With Quote  
Join Date: Sep 2007
Location: Hamilton New Zealand
Posts: 4
Reputation: RinoStoof is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
RinoStoof RinoStoof is offline Offline
Newbie Poster

Question Re: opening an Excel file in VB.NET

  #5  
Sep 7th, 2007
Hi there

I used the code as given but I get an error as follows:

System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147417851
Message="The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))"
Source="Interop.Excel"
StackTrace:
at Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)

So far I have wasted an afternoon trying to do this basic thing and I would be wrapped if someone could give me a little shove in the back :-)

Thanks very much!
Rino
Reply With Quote  
Join Date: Mar 2008
Posts: 4
Reputation: BarbaMariolino is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
BarbaMariolino BarbaMariolino is offline Offline
Newbie Poster

Re: opening an Excel file in VB.NET

  #6  
Mar 21st, 2008
I just want to inform you that there are better ways to Read/Write XLS/CSV/HTML/XLSX files from VB.NET than using Excel Automation (http://www.gemboxsoftware.com/GBSpreadsheet.htm). You can use our Free Spreadsheet .NET Component (http://www.gemboxsoftware.com/GBSpreadsheetFree.htm) even in your commercial applications.
Last edited by BarbaMariolino : Mar 21st, 2008 at 8:53 am.
Reply With Quote  
Join Date: Nov 2007
Location: � Jogja �
Posts: 2,596
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Rep Power: 12
Solved Threads: 237
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: opening an Excel file in VB.NET

  #7  
Mar 22nd, 2008
Good Info
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote  
Join Date: Jan 2008
Location: Jogjakarta
Posts: 96
Reputation: Estella is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 6
Estella's Avatar
Estella Estella is offline Offline
Junior Poster in Training

Re: opening an Excel file in VB.NET

  #8  
Mar 22nd, 2008
thanks for info..
Reply With Quote  
Join Date: Apr 2008
Posts: 1
Reputation: ian_taylor is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ian_taylor ian_taylor is offline Offline
Newbie Poster

Re: opening an Excel file in VB.NET

  #9  
Apr 18th, 2008
Originally Posted by daskeyboard View Post
The title of this thread pretty much says it all - I would like to know how to open an already created excel spreadsheet (I want the application to launch).
Thanks so much to anyone who has time to respond to this.


you can read worksheet like this

xlApp = New Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Open("c:\vbexcel.xlsx")
xlWorkSheet = xlWorkBook.Worksheets("sheet1")

range = xlWorkSheet.UsedRange

For rCnt = 1 To range.Rows.Count
For cCnt = 1 To range.Columns.Count
Obj = CType(range.Cells(rCnt, cCnt), Excel.Range)
MsgBox(Obj.value)
Next
Next


http://vb.net-informations.com/excel..._open_file.htm

http://vb.net-informations.com/excel..._worksheet.htm
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 1:03 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC