468,119 Members | 2,123 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,119 developers. It's quick & easy.

How to step into excel macro?

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.
Nov 20 '05 #1
2 6101
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.

Nov 20 '05 #2
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.

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Steven Stewart | last post: by
17 posts views Thread by Mansi | last post: by
4 posts views Thread by michael.pearmain | last post: by
7 posts views Thread by Holger Fitschen | last post: by
14 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.