Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi there
I am trying to make a windows form that uses excel to store some values entered by the user. But I am having some problems with the object libaries. The programs I use are Visual studio.net and Excel 2003 I am pretty much foloving the instructions in a book written by Michael Halvorson (Title: Visual Basic.Net Step By Step). The short version is that I must add a object libary to the visual basic project to make it work with excel. So I click the Project menu Add reference... select the COM tab and then the book says that I must scroll down and select the Microsoft Excel 10.0 Objevt Libary (I can see on a picture in the book that there also is a Microsoft Excel 5.0 Object Libary). But on my list there is Microsoft Excel 11.0 Object Libary and Microsoft Excel 5.0 Object Libary. So I selected the Microsoft Excel 11.0 Object Libary. But after entering the code in the book it does not work. Is it because of the difference between the object libaries? I hope that some of you can help me on this Kind regards Anders Jensen |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Did you try closing Excel and then reopening it? I have the 11.0 Version of
the Microsoft Excel Referenced. I also have the Microsoft Office Object Library. As for the commands, it kind of depends on what they are. (I do have 2 other references, OLE Automation and Visual Basic For Applications), however I am running those from within Excel 2003, not studio like you. " wrote: Hi there I am trying to make a windows form that uses excel to store some values entered by the user. But I am having some problems with the object libaries. The programs I use are Visual studio.net and Excel 2003 I am pretty much foloving the instructions in a book written by Michael Halvorson (Title: Visual Basic.Net Step By Step). The short version is that I must add a object libary to the visual basic project to make it work with excel. So I click the Project menu Add reference... select the COM tab and then the book says that I must scroll down and select the Microsoft Excel 10.0 Objevt Libary (I can see on a picture in the book that there also is a Microsoft Excel 5.0 Object Libary). But on my list there is Microsoft Excel 11.0 Object Libary and Microsoft Excel 5.0 Object Libary. So I selected the Microsoft Excel 11.0 Object Libary. But after entering the code in the book it does not work. Is it because of the difference between the object libaries? I hope that some of you can help me on this Kind regards Anders Jensen |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
About selecting the object libary, then it is selected in Visual Basic
and not in Excel. So Excel is not open at any time. The code the book says must be entered is (Microsoft Excel 10.0 Object Libary): 'Decleare Excel object variables and create types Dim xlApp As Excel.Application Dim xlBook As Excel.Workbook Dim xlSheet As Excel.Worksheet xlApp = CType(CreateObject("Excel.Application"), Excel.Application) xlBook = CType(xlApp.Workbooks.add, Excel.Workbook) xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet) When I have selected the Microsoft Excel 11.0 Object Libary then the code must be: 'Decleare Excel object variables and create types Dim xlApp As Microsoft.Office.Interop.Excel.Application Dim xlBook As Microsoft.Office.Interop.Excel.Workbook Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet xlApp = CType(CreateObject("Excel.Application"), Microsoft.Office.Interop.Excel.Application) xlBook = CType(xlApp.Workbooks.Add, Microsoft.Office.Interop.Excel.Workbook) xlSheet = CType(xlBook.Worksheets(1), Microsoft.Office.Interop.Excel.Worksheet) Note the difference betveen Excel.Application and Microsoft.Office.Interop.Excel.Application Kind regards Anders Jensen |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Code that works with Excel 10 should also work with Excel 11. Either you've
made a mistake with your code, or the code you're copying has a mistake in it (very common with books on programming). Can you post the error and the line that causes it? wrote in message oups.com... Hi there I am trying to make a windows form that uses excel to store some values entered by the user. But I am having some problems with the object libaries. The programs I use are Visual studio.net and Excel 2003 I am pretty much foloving the instructions in a book written by Michael Halvorson (Title: Visual Basic.Net Step By Step). The short version is that I must add a object libary to the visual basic project to make it work with excel. So I click the Project menu Add reference... select the COM tab and then the book says that I must scroll down and select the Microsoft Excel 10.0 Objevt Libary (I can see on a picture in the book that there also is a Microsoft Excel 5.0 Object Libary). But on my list there is Microsoft Excel 11.0 Object Libary and Microsoft Excel 5.0 Object Libary. So I selected the Microsoft Excel 11.0 Object Libary. But after entering the code in the book it does not work. Is it because of the difference between the object libaries? I hope that some of you can help me on this Kind regards Anders Jensen |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For some reason it works just fine now.
I was just changing out some code to paste in my reply to GB, and now it works :) Nice |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Microsoft Word and Excel 11.0 Object Library | Excel Discussion (Misc queries) | |||
Microsoft Excel 11.0 Object Library documentation? | Charts and Charting in Excel | |||
Microsoft Word Object Library in Excel | Excel Discussion (Misc queries) | |||
Using Microsoft Excel Chart object in VB6 | Charts and Charting in Excel | |||
VB 6 Toolbar and Microsoft Excel Object 9.0 | Excel Programming |