D
Dennis Kuhn
Caveat: I know this code isn't very elegant, but I'm under a deadline.
I've got three stacked objects on a report: two logos, and a white
rectangle. I'm running a macro that pushes the white rectangle to the
back, then pushes one of the logos to the back, effectively making
only one of them visible. The macro is basically a toggle for the
user to select which logo they want visible.
The macro code goes like this:
Sheets("Run Avg Sheet").Select
ActiveSheet.Shapes("Rectangle 54").Select
Selection.ShapeRange.ZOrder msoSendToBack
If Comp = "Main" Then
ActiveSheet.Shapes("Picture 55").Select
Selection.ShapeRange.ZOrder msoSendToBack
Else
ActiveSheet.Shapes("Picture 53").Select
Selection.ShapeRange.ZOrder msoSendToBack
End If
' ********WHY DOESN'T THIS WORK?????
Range("a1").Select
I get a "runtime error 1004: select method of range class failed"
error.
I know if I had more time I could screw around with this so I'm not
selecting and then sendingtoback, but again... deadline. I've tried
activesheet.shapes("Picture 53").selection.shaperange.zorder
msosendtoback
and
activesheet.shapes("Picture 53").shaperange.zorder msosendtoback
and other variants and haven't stumbled across the exact structure
necessary.
Can someone either give me the shortcut non-selecting version of these
three moves or give me a suggestion on another command that I need to
run to get the range select to work?
I don't want a graphic selected when I finish the macro if I can help
it.
Thanks in advance!
Dennis
I've got three stacked objects on a report: two logos, and a white
rectangle. I'm running a macro that pushes the white rectangle to the
back, then pushes one of the logos to the back, effectively making
only one of them visible. The macro is basically a toggle for the
user to select which logo they want visible.
The macro code goes like this:
Sheets("Run Avg Sheet").Select
ActiveSheet.Shapes("Rectangle 54").Select
Selection.ShapeRange.ZOrder msoSendToBack
If Comp = "Main" Then
ActiveSheet.Shapes("Picture 55").Select
Selection.ShapeRange.ZOrder msoSendToBack
Else
ActiveSheet.Shapes("Picture 53").Select
Selection.ShapeRange.ZOrder msoSendToBack
End If
' ********WHY DOESN'T THIS WORK?????
Range("a1").Select
I get a "runtime error 1004: select method of range class failed"
error.
I know if I had more time I could screw around with this so I'm not
selecting and then sendingtoback, but again... deadline. I've tried
activesheet.shapes("Picture 53").selection.shaperange.zorder
msosendtoback
and
activesheet.shapes("Picture 53").shaperange.zorder msosendtoback
and other variants and haven't stumbled across the exact structure
necessary.
Can someone either give me the shortcut non-selecting version of these
three moves or give me a suggestion on another command that I need to
run to get the range select to work?
I don't want a graphic selected when I finish the macro if I can help
it.
Thanks in advance!
Dennis