PDA

View Full Version : Collapse and Expand



SBucki
05-08-2014, 08:28 AM
Hi

I'm trying to create a form with boxes and headings that the box collapses so everyone can see just the headings and expand individually the boxes to enter information in, then collapse after to just view headings.

I used the code from wikihow, expand-and-collapse-in-microsoft-word, and it worked.

However when I try and do it for the next box on my form it doesn't work. I get a compile error (see attached screen print)11670

Can anyone explain what I am doing wrong or a simpler method. I really know nothing about VBA.

Thank you
Shelley

fumei
05-08-2014, 02:01 PM
The compile error is simple to fix. You can not have two subroutines with the same name. You have two named MYMACRO(). Rename one.

SBucki
05-09-2014, 02:32 AM
Can I use any name? The MYMACRO was what wikihow gave me, So could I call them BOX1, BOX2 etc?

macropod
05-09-2014, 04:20 PM
Macros can have any name you want to give them, provided the name doesn't include invalid characters, isn't a duplicate or doesn't match certain reserved words, VBA properties, etc. (e.g. don't call a macro 'ActiveDocument'). The VBE will warn you or have a hissy-fit if you transgress these rules. Conversely, you can use names that match various built-in functions, so as to hijack them (e.g. FilePrint).

SBucki
05-12-2014, 01:38 AM
Thank you, it is working now, and I think I might just understand a little about what I am typing in!! Thanks for all your help.

SBucki
05-13-2014, 03:24 AM
Sorry further issue if anyone can advise. It works on my computer, works on my colleagues computer, but for 3 other colleagues it doesn't work. They open up the document, select the form and it opens already expanded and the buttons to collapse the rows do not work. When they open the document they get asked to enable macros, which they do, but that makes no difference.

Is this to do with their machine settings, or is it something I can fix?

Thanks