PDA

View Full Version : Solved: VBA migration to VB6



Dave
01-14-2006, 10:02 AM
Is this possible and/or is there a commercial product available to do it? I would like to convert an XL wb into a stand alone executable using vb6 if this is possible without starting from scratch. The wb has userforms and code and uses the sheets only to store data. My net surfing has yielded zip other than http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_vsto2005_ta/html/OfficeVSTOExcelVBAMigration.asp which seems to indicate that it is possible but I don't have visual studio 2005. Any advice/comments would be welcome. Dave

Killian
01-15-2006, 10:27 AM
Hi Dave,

I'm not aware of any product that does this. That said, in most cases it isn't a huge problem to do it from scratch.
Once you've set up a VB6 project and added a reference to Excel, your standard modules and classes will import directly and there's a good chance there won't be much to do there other than set up object variables for the Excel objects you previously referred to directly.
Recreating the forms will require a little more work but again, the code itself shouldn't need too much tweaking.

Porting over to VB.Net is a different proposition since the underlying technologies (COM vs the .Net CLR) aren't compatible. And that's just where it starts... I've started from scratch with just about every VB5/6 app I've tried to bring in to .Net and even the code I've re-used has had to be substantially modified in some way.
I haven't used VSTO so can't comment on whether that's any easier but I can't imagine it would be.

I don't think there's a shortcut here, but it's a relatively small step from VBA to VB6.

Dave
01-15-2006, 11:45 AM
Thank you Killian. I very much appreciate your comments. I guess I will find out just how difficult this migration/re-build is. I may need some assistance on this so I may need to post a follow-up inquiry to this thread. I'll leave it unsolved for now. Again, thanks. Dave

Bob Phillips
01-15-2006, 12:20 PM
You have to ask why though? Is the XL app currentlky using Excel functionality, does it read/write workbooks at all? Whilst this is possible from VB, not even hard, it seems a redundant exercise. Whilst .Net may be MS' view of the future, there is a lot of legacy VBA and VB code out there that MS will abandon at its peril.

Of course, VB6 is a much fuller development environment, forms are better etc., so there are advantages.

As to when you do this if you do, I would suggest a separate thread for each new topic. Threads should only be left open IMO if that topic is continuing, and whilst you will be in the same functional area, each item will be different.

Dave
01-15-2006, 02:25 PM
Thanks XLD. I know the future is .NET, however I don't have a copy of that program. My reason was to enhance the program security. I will mark this thread solved as per your suggestion. Have a nice day. Dave