I have an image on an excel 2007 workbook, with some text boxes on top. The image and text changes every 5 minutes approx with some VBA code I put behind.
The image object has been sent to back, so the text boxes should be shown on top...but for some strange reason, it doesn't.
it works fine in excel 2003, but not in 2007.
Anyone knows why and, most importantly, is there a way of fixing what appears to be a bug ?.
Note that I have tried also to insert an image instead (from Insert>Image) and that works (the text is on top of image), however it is a different type of object and I cannot make the VBA code work with this type of image object.
I have tried the following code I found in the forum, but some how I am unable to name the image as "Image_2" so nothing happens. I use a random selector (photo_array(rrr)) to change the image and text automatically.
Thanks in advance
strPic = "Image_2"
Set shp = WS.Shapes(strPic)
'Capture properties of exisitng picture such as location and size
With shp
t = .Top
l = .Left
h = .Height
w = .Width
End With
WS.Shapes(strPic).Delete
Set shp = WS.Shapes.AddPicture(ThisWorkbook.Path & "\images\" & photo_array(rrr), msoFalse, msoTrue, l, t, w, h)
shp.Name = "Image_2" ' strPic
shp.ScaleHeight Factor:=1, RelativeToOriginalSize:=msoTrue
shp.ScaleWidth Factor:=1, RelativeToOriginalSize:=msoTrue
Since you keep adding a new picture, it is being put on the top of the
ZOrder
by default.Try adding this line at the end:
This should put the picture back where you want it to be... in the back.