How to step into excel macro?

C

CR

How do you "step into" an excel macro when using the VB.NET debugger?
I'm using excel 2000.


Here's is how I did it with VB6:

Dim objExcel As Excel.Application
objExcel = New Excel.Application
objExcel.Visible = True
objExcel.Workbooks.Open(FileName:="c:\test.xls")
objExcel.CommandBars(1).FindControl(, 1695, , , True).Execute()
objExcel.Run("test.xls!test.test)

Thanks!

Chuck.
 
B

Bharat Patel [MSFT]

Hi Chuck,

I am not sure if you will be able to debug the macro from within VB.net;
however, if you are asking for how to run the macro from within VB.net, the
following article has a sample.

306682 HOWTO: Run Office Macros by Using Automation from Visual Basic .NET
http://support.microsoft.com/?id=306682

Here is another article which will be useful if you plan to create a macro.

303871 HOW TO: Create an Excel Macro by Using Automation from Visual Basic .NET
http://support.microsoft.com/?id=303871


Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 
B

Bharat Patel [MSFT]

Hi,

I read your another post and it looks like you want to save the data to CSV
file but all hidden range is saved too.
To work around this, you can copy the usedrange and paste it using PasteSpecial
in a new worksheet and then save this new worksheet as CSV file.

objSheet = objBook.Worksheets(1)
objSheet.UsedRange.Copy()
objBook.Worksheets(2).Activate()
objBook.Worksheets(2).Range("A1").PasteSpecial()


Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top