+ Reply to Thread
Results 1 to 11 of 11

Convert VBA to VB6...

  1. #1
    Registered User
    Join Date
    10-22-2008
    Location
    Michigan
    Posts
    26

    Convert VBA to VB6...

    I have a rather large "application" that I've built into a spreadsheet at work (about 1200 lines of code, 4 forms, and code on a few spreadsheets).

    I'd like to convert all this code and the forms into a VB6 project so I can have this application as an executable separate from the workbook, if possible.

    I tried exporting the forms, but they show in the project explorer as Designers.

    How can I do this?!

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387
    Cicatrize,

    A lot of information here: try searching Google for "Convert VBA to VB6".


    Have a great day,
    Stan
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I don't think you will find this is easy, I don't think there is an easy way to create an exe file from a excel workbook.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    10-22-2008
    Location
    Michigan
    Posts
    26
    Quote Originally Posted by stanleydgromjr View Post
    Cicatrize,

    A lot of information here: try searching Google for "Convert VBA to VB6".


    Have a great day,
    Stan
    I tried this and couldn't find anything.

  5. #5
    Registered User
    Join Date
    10-22-2008
    Location
    Michigan
    Posts
    26
    Quote Originally Posted by royUK View Post
    I don't think you will find this is easy, I don't think there is an easy way to create an exe file from a excel workbook.
    All I need to do is export the forms into a VB6 form format and then copy the code over, but when I try to do this, it opens in VB6 as a Designer form, not an actual form.

    Do you know of a way to load it properly??

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    They are not exactly the same and code is slightly different so I don't se how you can

  7. #7
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284
    Quote Originally Posted by Cicatrize View Post
    All I need to do is export the forms into a VB6 form format and then copy the code over, but when I try to do this, it opens in VB6 as a Designer form, not an actual form.

    Do you know of a way to load it properly??
    You would best rebuild the forms from scratch, four isn't many. Most of the code will be the same, just note that it is Form_Load, not Userform_Initialize, and VB uses a different naming convention for controls (but you should be using a naming convention anyway).

  8. #8
    Registered User
    Join Date
    10-22-2008
    Location
    Michigan
    Posts
    26
    Quote Originally Posted by Bob Phillips View Post
    You would best rebuild the forms from scratch, four isn't many. Most of the code will be the same, just note that it is Form_Load, not Userform_Initialize, and VB uses a different naming convention for controls (but you should be using a naming convention anyway).
    Yeah, I know more about VB6 than I do about VBA, so that won't be an issue. I was just wondering if there was an easy way to convert it. There are a LOT of controls on the main form.

  9. #9
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284
    I just tried a simple test.

    I created a VBA form and exported it, and open the .frm file in a text editor. I had to change this line

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    and remove this line

    Please Login or Register  to view this content.
    and then it was virtually identical to a VB6 form. So I dragged it into my VB6 projectm, and it showed as a VB6 type form, but no controls showed. It seems the VB6 control positions are defined in the .frm file, so I just had to add some code to show then, like so

    Please Login or Register  to view this content.
    got it afresh, and all seemed well.

    I emphasise that I tested this on a simple form but it seemed to work, and it should be simple to write some code to generate that extra control info from within VBA.

  10. #10
    Registered User
    Join Date
    10-22-2008
    Location
    Michigan
    Posts
    26
    Thanks, but I'd have to do that for all my controls, and it'd just be easier to start the whole project from scratch again. Oh well. Thanks for the help guys.

  11. #11
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284
    Quote Originally Posted by Cicatrize View Post
    Thanks, but I'd have to do that for all my controls, and it'd just be easier to start the whole project from scratch again. Oh well. Thanks for the help guys.
    I am talking about automating it, but it's your choice.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1