Hi RobRobby,
Very interesting question. See the attached file which uses the 'Group' attribute and appropriate naming of shapes to toggle the visibility of images on a Shape. Grouping is not absolutely necessary, but it seemed like 'herding cats' when the shapes were not grouped.
The file is adapted from an old application. The items of interest to you are located on the bottom part of 'Sheet1'.
I created a Group consisting of a Shape and two images. I created the group as follows:
a. Created Cyan Shape. Renamed Shape to Shape01 (Renaming Macro is included).
b. Imported .jpg Red Image. Renamed Image to Image01A.
c. Imported .jpg Green Image. Renamed Image to Image01B.
d. Held down 'Ctrl' Key. Selected (Left Clicked) all 3 items. 'Right Clicked' > Grouping > Group
e, Renamed the Group to 'Group01'.
NOTE:
1. You probably want to have all the images on top of each other.
2. Instead of using the Visible attribute, the ZOrder attribute can be used to put a SPECIFIC IMAGE on top.
Applicable code in Ordinary Code module ModGroup:
Rename Shape Code in Ordinary Code Module ModNextButton:
It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
This option requires all variables to be declared and will give a compiler error for undeclared variables.
If you need additional help, you will probably have to upload a sample workbook.
Lewis
Bookmarks