isladogs
MVP / VIP
- Local time
- Today, 00:53
- Joined
- Jan 14, 2017
- Messages
- 18,246
Having a brain fade here....
I have 6 buttons cmd1 to cmd6 that I want to click once each in random order.
The standard code is Me("cmd" & I)
It works fine for properties e.g. Me("cmd" & I).Visible but fails for events e.g.
Me("cmd" & I).Click => error 438 - object doesn't support this property or method
I also tried Me("cmd" & I) & "_Click" without success - invalid use of property with Me highlighted
Omitting Me and everything else I've tried shows the code in RED
e.g. ("cmd" & I)_Click or "cmd" & I_Click etc
Does anyone know the correct syntax for this?
At the moment I'm using Select Case as a temporary fix but there has to be a better way
I have 6 buttons cmd1 to cmd6 that I want to click once each in random order.
The standard code is Me("cmd" & I)
It works fine for properties e.g. Me("cmd" & I).Visible but fails for events e.g.
Me("cmd" & I).Click => error 438 - object doesn't support this property or method
I also tried Me("cmd" & I) & "_Click" without success - invalid use of property with Me highlighted
Omitting Me and everything else I've tried shows the code in RED
e.g. ("cmd" & I)_Click or "cmd" & I_Click etc
Does anyone know the correct syntax for this?
At the moment I'm using Select Case as a temporary fix but there has to be a better way