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

Calling an Excel macro from VB.NET

P: n/a
I just upgraded from Office 2000 to Office 2003. My VB.NET Excel macro
calls don't work any longer.

Here is how I make my Excel macro call from VB.NET:

Dim objExcel as Excel.Application

objExcel = New Excel.Application
objExcel.Workbooks.Open(FileName:="c:\test.xls", ReadOnly:=True)
objExcel.Run("test.xls!test.test")

I was using the COM object Microsoft Excel 9.0. I noticed that it has
been replaced by Microsoft Excel 11.0. I tried adding that as a
reference but now the Excel object is undefined.

Help!

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Imports Microsoft.Office.Interop
'Add above to the top of class files using Excel object.

<cr***@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I just upgraded from Office 2000 to Office 2003. My VB.NET Excel macro
calls don't work any longer.

Here is how I make my Excel macro call from VB.NET:

Dim objExcel as Excel.Application

objExcel = New Excel.Application
objExcel.Workbooks.Open(FileName:="c:\test.xls", ReadOnly:=True)
objExcel.Run("test.xls!test.test")

I was using the COM object Microsoft Excel 9.0. I noticed that it has
been replaced by Microsoft Excel 11.0. I tried adding that as a
reference but now the Excel object is undefined.

Help!

Nov 21 '05 #2

P: n/a
Jim Hughes wrote:
Imports Microsoft.Office.Interop
'Add above to the top of class files using Excel object.


That works but now there is another problem. There is a 15 second delay
from the time I call the macro until it actually gets executed. I've
already decided to switch back to 2000. I'm also going to rewrite all
my Excel macros. I'll probably use datagrids or something. Calling
macros is too flakey.

Do you know why the imports statement is required for Microsoft Excel
11.0 but not for Microsoft Excel 9.0? I still don't understand
namespaces...

Thanks!

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.