p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Visual Basic > VB 2008 > Visual Basic 2008 Essentials
I forgot my password Register Now
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 21st, 2009, 03:58 AM
Authorized User
Points: 274, Level: 5
Points: 274, Level: 5 Points: 274, Level: 5 Points: 274, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2008
Location: , , Russia.
Posts: 62
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create COM Add in for Excel 2007 bananashark Visual Studio Tools for Office 1 November 27th, 2008 02:51 PM
Connect to SQL Database with Visual Basic 2008 enizag VB Databases Basics 5 October 22nd, 2008 01:04 PM
Error on Visual Basic 6 Install File with CR XI R2 jmss66 Crystal Reports 0 August 25th, 2008 11: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 04:39 PM



All times are GMT -4. The time now is 07:10 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc