Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > Visual Basic 2008 Essentials
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 21st, 2009, 03:58 AM
Authorized User
 
Join Date: Mar 2008
Location: , , Russia.
Posts: 74
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via ICQ to sektor
Default Error when create Excel 2007 file in Visual Basic 2008

I wanna create an empty Excel 2007 file thru Visual Basic 2008. I added reference to "Microsoft Excel 12.0 Object Library" from "COM" tab of "Add reference" window.

I wrote following code, but it fails to run - VS 2008 points on "xlBook = xlApp.Workbooks.Add()" line and says - "Old format is used or library has wrong type. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))"

What is the reason?


Code (on usual button):


Option Strict Off
Imports MyExcel = Microsoft.Office.Interop.Excel

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim xlApp As New MyExcel.Application()
Dim xlBook As MyExcel.Workbook
Dim xlSheet As MyExcel.Sheets()

xlBook = xlApp.Workbooks.Add()
xlSheet = xlBook.Worksheets("Sheet1")

xlApp.Visible = True

End Sub
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connect to SQL Database with Visual Basic 2008 enizag VB Databases Basics 5 October 22nd, 2008 12:04 PM
Error on Visual Basic 6 Install File with CR XI R2 jmss66 Crystal Reports 0 August 25th, 2008 10:41 AM
visual basic in excel help me pakmaniac Access VBA 2 January 2nd, 2004 10:55 AM
Excel-Visual basic kasimg Excel VBA 1 August 9th, 2003 03:39 PM



All times are GMT -4. The time now is 03:15 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.