473,809 Members | 2,506 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Interop.Excel.R un

I got the following error:
=============
Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMIS MATCH))
=============

when using Interop.Excel.R un. The relevant code is from "Microsoft .Net
Development for Microsoft Office":

=============== =============== =
using System;
using System.Collecti ons.Generic;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows. Forms;
using Excel = Microsoft.Offic e.Interop.Excel ;

namespace whatever
{
public partial class ManagedCallBack : Form
{
object missing = System.Reflecti on.Missing.Valu e;
public ManagedCallBack ()
{
InitializeCompo nent();
}

private void button1_Click(o bject sender, EventArgs e)
{
Excel.Applicati on xl = new
Microsoft.Offic e.Interop.Excel .Application();
xl.Visible = true;
xl.Workbooks.Op en(@"C:\Temp\Ma nagedCallback\M anagedCallback. xls",
missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing, missing,
missing, missing);
xl.Run("CacheMa nagedObject", this, //
<---------here ---------
missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing);
}
}
=============== =============== ======

Excel opens fine, the desired xls file, which has a VBA public sub
CacheManagedObj ect in on of its standard module. Security is set to low.
The OS is Vista and Excel 2003 is the target.

Someone has an idea about what is wrong with my xl.Run( ) ?
Thanks,
Vanderghast, Access MVP

Jun 27 '08 #1
0 1322

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1011
by: Le Thanh Thuan | last post by:
In my VB.Net project, I using Interop.Excel 11.0 (Excel 2003 I create Setup project in my computer, and then , I setup in another computer using Excel 2000 When I run my application, a error occur File or assembly name Interop.Excel, or one of its dependencies, was not found. File name"Interop.Excel"
1
8422
by: Steve B. | last post by:
Why does Office create a compile error when doing a Release compile but not when doing a Debug complie. Release compile is compiled to the network share drive - Excel Interop is added as a reference in the VS Project window. - Excel PIA Interop is located on the same network location as the exe and the share directory with PIA is included in the project path - Other projects in the same solution also reference Office with no problem ...
4
8105
by: Robert | last post by:
I have created a .dll in C# which has a reference to Excel. When I add a strong name to the .dll in the AssemblyInfo.cs and try to rebuild, I get the following error: Assembly generation failed -- Referenced assembly 'Interop.Excel' does not have a strong name How can this be resolved? -- Robert Hill
2
12679
by: Alex D. | last post by:
Hi .I cant seem to find a way to authorize asp.net user to create an Excel application using this: Microsoft.Office.Interop.Excel.ApplicationClass excel = new Microsoft.Office.Interop.Excel.ApplicationClass(); I keep getting this error: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed with HRESULT: 0x80070005(Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)))....
3
5113
by: Brent | last post by:
I'm trying to open and manipulate an Excel spreadsheet from C#. To that end, I've referenced Interop.EXCEL9.dll, which I have on my machine. All of the examples I've read say to do something like this: -------------------------- Excel.Application xl = new Excel.ApplicationClass(); xl.Visible = "true"; String workbookPath = @"c:\SomeWorkBook.xls"; Excel.Workbook xlW = xlW.Workbooks.Open(workbookPath,0, false, 5, "",
1
1943
by: Geoff | last post by:
Hello I am having an issue with my code below not closing EXCEL.EXE when I tell it do. Any help would be appreciated. ----- Dim excel As Microsoft.Office.Interop.Excel.Application Dim wb As Microsoft.Office.Interop.Excel.Workbook Dim ws As Microsoft.Office.Interop.Excel.Worksheet
0
4137
by: Bill Fallon | last post by:
I am developing a VB.Net application with VS 2005 that opens an Excel workbook and populates the worksheet with data. I started developing the application with Office 2007 installed on my Vista OS, but after I discovered that it won't run on a system with Office 2003, I uninstalled Office 2007 and installed Office 2003. I reset the reference in .Net to the Microsoft Excel 11.0 Object Library. The application works fine from the ..Net...
2
8352
by: GS | last post by:
I have installed the ms PIA for ofc XP, and followed the article http://support.microsoft.com/kb/247412/ trying to paste into a worksheet However I got late binding not allowed errors .... webOCWraooer,Copy // get the desired data into clapboard
5
1908
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I've been tasked to translate a C# program to VB. (Dot Net 2.0.) I'm starting from scratch with no documentation and I'm trying to understand what the original programmer did. (The 'original programmer' is conveniently off on vacation so I can't ask him.) The program deals in some way with Excel spreadsheets. There is a line of code in the program: CurSheet =...
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10643
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10391
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.