Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 24th, 2005, 09:27 PM
Registered User
 
Join Date: May 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can't reference to range in excel project 2003

I can't refence to range in VS 2003 C# office excel project

This code is not work
wsSheet1 = (Excel.Worksheet) ThisApplication.ActiveWorkbook.Sheets["Sheet1"];
Excel.Range myrange = (Excel.Range)wsSheet1.get_Range("A1",Type.Missing) ;

please show me example code

Thank you very much

 
Old May 26th, 2005, 02:35 AM
Registered User
 
Join Date: May 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I can't automate excel

this is my error
"Error: COM object with CLSID {00020819-0000-0000-C000-000000000046} is either not valid or not registered."

help me please
Thank you very much

 
Old May 26th, 2005, 03:12 AM
Registered User
 
Join Date: May 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

and
"Error: Exception from HRESULT: 0x800A03EC."

help me please
thank you very much

 
Old March 8th, 2006, 07:24 AM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem is probably the way of creating the object instance. You don't create new instances of workbook objects like
you are doing with the line:
ExcelWB = New Excel.Workbook
you open them through the application object. What the error message is telling you is COM can't co-create the workbook object.
Try something like this:

Dim ExcelApp As Excel.Application
Dim ExcelWB As Excel.Workbook

ExcelWB = ExcelApp.Workbooks.Open("File Path")
ExcelApp.Visible = True







Similar Threads
Thread Thread Starter Forum Replies Last Post
cant add Reference to a visual basic project tiyyob Pro VB 6 5 March 31st, 2009 05:57 PM
VS 2003 Project SKhna ASP.NET 2.0 Basics 1 February 4th, 2008 02:47 AM
Importing a Range from Excel JezLisle Access VBA 0 July 27th, 2007 02:54 AM





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