944,165 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 185658
  • VB.NET RSS
You are currently viewing page 1 of this multi-page discussion thread
Jul 26th, 2005
-2

opening an Excel file in VB.NET

Expand 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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
daskeyboard is offline Offline
2 posts
since Jul 2005
Jul 26th, 2005
0

Re: opening an Excel file in VB.NET

Quote 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
Reputation Points: 11
Solved Threads: 6
Junior Poster
Letscode is offline Offline
175 posts
since Feb 2005
Jul 27th, 2005
0

Re: opening an Excel file in VB.NET

Anyone have another suggestion - the microsoft example is slightly prolix.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
daskeyboard is offline Offline
2 posts
since Jul 2005
Aug 2nd, 2005
0

Re: opening an Excel file in VB.NET

Quote 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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Wolfskind is offline Offline
1 posts
since Aug 2005
Sep 7th, 2007
0

Re: opening an Excel file in VB.NET

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
RinoStoof is offline Offline
4 posts
since Sep 2007
Mar 22nd, 2008
0

Re: opening an Excel file in VB.NET

Good Info
Reputation Points: 1182
Solved Threads: 393
Posting Sensei
Jx_Man is offline Offline
3,145 posts
since Nov 2007
Mar 22nd, 2008
0

Re: opening an Excel file in VB.NET

thanks for info..
Reputation Points: 37
Solved Threads: 7
Junior Poster in Training
Estella is offline Offline
99 posts
since Jan 2008
Apr 18th, 2008
0

Re: opening an Excel file in VB.NET

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ian_taylor is offline Offline
1 posts
since Apr 2008
Aug 11th, 2009
0

Re: opening an Excel file in VB.NET

Thank you, ian_taylor

Your url really helps me

I need tutorial about crystal report and i find them in the related url in your link

Thank!!! Kids
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Kids is offline Offline
7 posts
since Aug 2009
Aug 27th, 2009
0

Re: opening an Excel file in VB.NET

Click to Expand / Collapse  Quote originally posted by Wolfskind ...

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
I have use this code. But I resive runtime errow "Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))". If anyone know how to dilling with this error please answer
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ollia is offline Offline
1 posts
since Aug 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in VB.NET Forum Timeline: MS Access to VB.NET Question
Next Thread in VB.NET Forum Timeline: MS Access to VB.NET Question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC