VB.NET with Excel VBA

F

forger

I want to consider accessing the Excel Object Model from Visual Studio using
VB.NET. Can the Excel Object Model be accessed from the Visual Studio VB.NET
IDE in essentially the same manner as I currently do this from the built-in
Excel VBA IDE? That is, step thru program, check modified Ranges in
Worksheets, etc., in a normal debugging process. Can anyone reassure me
(share their experience) on the efficacy of accessing Excel VBA via Visual
Studio VB.NET. I did check the Office Developer User Group, but nothing much
was discussed about this there.

Background: I currently have large functioning Excel VBA programs, which
calculate dimensions for die designs for our CAD system, using the built-in
Excel VBA IDE. Our CAD system just introduced a VB.NET API, and I would like
to change the dimensions, calculated in Excel VBA, directly within the CAD
Object Model, from the CAD system's VB API in Visual Studio. Currently I am
passing the calculated dimensions to the CAD system through text files via a
very complicated process. I can't get the CAD system's VB API to work
properly with the Excel VBA IDE, probably because some VB.NET code (e.g. Try
blocks) isn't recognized. Sorry for the long post, but I wanted to be clear
on what I wanted to do.
 
C

Carlos Mallen

Hi, the VBA code cannot be used in VB. I'm also migrating from VBA to VB, but
it has been very difficult for me, because everything is different. In VB you
can use the Visual Studio Tools for Office, which is a module to target
Office applications.

The following links might be helpful:

msdn.microsoft.com/en-us/vsto/default.aspx
msdn.microsoft.com/en-us/library/23cw517s.aspx
 
F

forger

Hi Carlos. I saw your earlier post. I don't think you are entirely correct
about the language part. For instance, from what I can tell, the Set
statement still works. I have seen it used extensively in our CAD system's VB
API User Guide. I just want to know if the Visual Studio VB.NET IDE works
with Excel as seamlessly as the built-in Excel VBA IDE does. I understand
about .COM to .NET translations. I can handle the language differences. I
can read up on this, take courses, etc. I'll modify the code accordingly.
From what I can tell, it is more a matter of adding code, rather than
modifying existing VB code. VBA is essentially just VB6, and I think VB.NET
is mostly backward-compatible with it. I learned Java, I'm sure I can tackle
VB.NET.
 
C

Carlos Mallen

Well, when I try to use Set, the IDE immediately underlines Set with a jagged
line, indicating that I've done a mistake while typying. The tooltip clearly
says 'Let' and 'Set' assignment statements are no longer supported. If I
start debugging, I get the error "There were build errors. Would you like to
continue and run the last successful build?". Classes are also written
differently.

I've read that Visual Studio 2008 offers and upgrade wizard to migrate VB 6
to VB 2008. Perhaps that would be useful for you.
 

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