By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,892 Members | 1,238 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,892 IT Pros & Developers. It's quick & easy.

Interop.Excel.Run

P: n/a
I got the following error:
=============
Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
=============

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

===============================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;

namespace whatever
{
public partial class ManagedCallBack : Form
{
object missing = System.Reflection.Missing.Value;
public ManagedCallBack()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Excel.Application xl = new
Microsoft.Office.Interop.Excel.Application();
xl.Visible = true;
xl.Workbooks.Open(@"C:\Temp\ManagedCallback\Manage dCallback.xls",
missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing, missing,
missing, missing);
xl.Run("CacheManagedObject", 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
CacheManagedObject 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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.