dcsimg
Results 1 to 2 of 2

Thread: How to convert VBA proyect (excel) into Visual studio?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2018
    Posts
    42

    Question How to convert VBA proyect (excel) into Visual studio?

    Hi all,

    I want to move a program I've develop in excel (VBA) into a Visual Studio proyect.

    I perfectly know it is going to be far from a simple copy-paste, and I was decided to start the new proyect in visual studio and adapt-reuse the code as much as possible making the needed changes.

    The question is I've found some links that talks about a "Update Wizard" existing in Visual Studio 2008 (no newer versions) and "Migrating Code from Visual Basic 6 to .NET", for example:

    https://blogs.msdn.microsoft.com/gov...asic-6-to-net/

    In this link someone advices to install VS 2008 to do so, then moving to a newer VS version.

    https://social.msdn.microsoft.com/Fo...orum=vbgeneral

    I don't know if it's valid only for VB6 proyects or can be applied also to my program (developed inside an excel file). I've install VS 2008 + SP1 but I can't get anything from this.

    Can someone tell me if what I want is possible? I'm pefectly aware that in any case I'm going to have a copy-paste and everything works, but if there is a wizard that reads my VBA code and translate into VB.net and saves me some time, it would be very helpful.

    Regards in advance

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,227

    Re: How to convert VBA proyect (excel) into Visual studio?

    I'm afraid that won't really be possible... translating from VBA to VB6 isn't as simple as you may think (even tho lots of the code can be copied+pasted without changes), so I wouldn't be surprised if the wizard doesn't do anything.

    Note however that the wizard didn't magically make VB6 projects work in .Net, it left lots of parts for you to fix yourself... and several of the code conversions it did were odd ways to do things (but probably the best "safe" thing to do in those circumstances).


    Your best bet is probably to make a new project in VB.Net, and in the situations is it appropriate copy+paste your VBA code (it will generally only need fairly minor modifications to work, but some things will be trickier).

    As a general rule tho, you will get a much better project in the end if you just re-write it using the original code as a guideline, and it won't take much more time (my first .Net project was re-writing a VB6 project, and it took me less time than the VB6 version would have).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width