+ Reply to Thread
Results 1 to 6 of 6

Creating form Programmatically in the module using vba-excel

  1. #1
    Registered User
    Join Date
    07-13-2012
    Location
    islamabad
    MS-Off Ver
    Excel 2010
    Posts
    15

    Exclamation Creating form Programmatically in the module using vba-excel

    hy. i want to create a user form in the module using vba programmatically. i am novice and inexperience so i have tried couple of examples but they are not fullfilling my requirements.
    i just want macro that

    > creates user form created in module using vba
    > has a listbox with some data
    > a CommandButton with a listener

    Bingo That's All. please its urgent...

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Creating form Programmatically in the module using vba-excel

    See attached file where I added a module with a macro.
    If you want to run code on new excel file you need to add a reference.
    Open Visual Basic Editor (Alt + F11), choose Tools, References and add 'Microsoft Forms 2.0 Object Library' or click on Browse and select c:\windows\system32\fm20.dll file.

    This is the macro if you can't download the file:
    Please Login or Register  to view this content.
    Regards,
    Antonio
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-13-2012
    Location
    islamabad
    MS-Off Ver
    Excel 2010
    Posts
    15

    Thumbs up Re: Creating form Programmatically in the module using vba-excel

    Quote Originally Posted by antoka05 View Post
    See attached file where I added a module with a macro.
    If you want to run code on new excel file you need to add a reference.
    Open Visual Basic Editor (Alt + F11), choose Tools, References and add 'Microsoft Forms 2.0 Object Library' or click on Browse and select c:\windows\system32\fm20.dll file.

    This is the macro if you can't download the file:
    Please Login or Register  to view this content.
    Regards,
    Antonio

    Awesome Man. Than you so Much. There should be a treat for you. One more thing i would like to ask, i.e. when i run that module it creates a UserForm at vb side as well. and when ever i again run it generates the userform sequence. could there be a function that when that macro runs a userform is created and when it is UnLoaded that userform finishes.??

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Creating form Programmatically in the module using vba-excel

    Why not just create the userform manually. This seems like an awful lot of work for something as trivial?

  5. #5
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Creating form Programmatically in the module using vba-excel

    To delete form at form unload you could add these lines:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  6. #6
    Registered User
    Join Date
    07-13-2012
    Location
    islamabad
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Creating form Programmatically in the module using vba-excel

    Thank You All. You All Really Deserve a treat(On Your Own. LoLzz). Thanks to All once again

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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