Don't know about Excel, but in Word, while you can copy the button control itself, as you have discovered, the code does NOT come along with it. This is a function of SCOPE. Code in form modules (as opposed to standard or class modules) are PRIVATE to that form module - as long as the other form module is in the same project...which it is.
You can export the form module to another project, rename it and import it back into the first project.
Well, The not so pretty way would be to copy the button over. Then, launch the VB editor and copy all of the code from one sheet to the destination sheet. You might have to tweak the Userform so it sees the code in the new sheet but it should work.
The other method would be to place the code in a module instead of the Sheet. That would allow you to call it from any sheet.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.