+ Reply to Thread
Results 1 to 5 of 5

Macro writen macros for objects will not run

  1. #1
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Macro writen macros for objects will not run

    I have a userform with multipage containing several objects. on this form is a button that adds another page to the multipage copies all of the objects over and renames them (so listbox 1 on page 1 becomes listbox 2 on page 2) as far as I am aware this works (used the msgbox method to check all the names are assigned when the userform is running).
    during this rename of the created objects the script writes some macros for the necessary copied objects:
    Please Login or Register  to view this content.
    the code is written (if I close the form and open the VBA editor I can see it) however it doesn't run when I click the new Addlaminate2 button on multipage page 2 there is no error message there is nothing it is as if there is no code written for the button.

    any ideas why this happens and how to fix it?

    Regards
    Leon

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    How exactly are you copying the controls?

    Have you considered using classes to handle the events of the new controls?
    Last edited by Norie; 11-30-2012 at 12:05 PM.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: Macro writen macros for objects will not run

    I am copying them using:
    Please Login or Register  to view this content.
    The full renaming script is:
    Please Login or Register  to view this content.
    The range AA is just a list of control names

    I don't know much about class modules but as far as I can tell the problem isn't with the controls using the same procedure the copied controls won't use any procedure. But as I say I don't know much about class modules (power programming chapter 29 I may skip ahead and check it out) if you think they will help I'm open to suggestion.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Macro writen macros for objects will not run

    I think they might help but I think I would need to see a sample workbook to see exactly what you've got.

  5. #5
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: Macro writen macros for objects will not run

    to get to the error enter a title (a single character will do), in the second form add some materials and click add batch the batch 1 page controls will function the batch 2 page controls don't do anything the the macro code for thoes controls will have been writen to VBA editor.

    builder.xlsm

+ 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