Welcome to Dream.In.Code
Become a VB Expert!

Join 149,947 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,401 people online right now. Registration is fast and FREE... Join Now!




help with .XLS

 
Reply to this topicStart new topic

help with .XLS

Multikill
21 Dec, 2007 - 05:04 AM
Post #1

New D.I.C Head
*

Joined: 21 Dec, 2007
Posts: 1

i need help with Excel. im tring to make that a program reads the value from .xls the file.
heres my code:

top of code:

CODE
Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop.Excel



the code:

CODE
       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.Open("C:\Kurssit.xls"), Excel.Workbook)
        xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)

        With xlSheet.Application.Cells

            .Visible = False

            MessageBox.Show(.Cells(6, 3).ToString)

            ' close the workbook.

            .Quit()

        End With


I get this error:

IPB Image
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 05:15PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month