excel 2007图像不会回来 [英] excel 2007 image doesn't go to back
问题描述
图像和文本每隔5分钟更改一些VBA代码。
图像对象已经发送回来,所以文本框应该
它在excel 2003中正常工作,但不在2007年。
任何人都知道为什么,最重要的是有一种方法来修复似乎是一个错误?
请注意,我也尝试插入一个图像(从插入>图像),并且工作(文本在图像上),但它是一种不同类型的对象,我不能使VBA代码与这种类型的图像对象一起工作。
我已经尝试了在论坛中找到的以下代码,但有些我无法将图像命名为Image_2,所以没有任何反应。
我使用随机选择器(photo_array(rrr))自动更改图像和文字。
提前感谢
strPic =Image_2
设置shp = WS.Shapes(strPic)
'捕获诸如位置等exeitng图片的属性和大小
与shp
t = .Top
l = .Left
h = .Height
w = .Width
结束
WS.Shapes(strPic).Delete
设置shp = WS.Shapes.AddPicture(ThisWorkbook.Path&\images\& photo_array(rrr),msoFalse,msoTrue,l, t,w,h)
shp.Name =Image_2'strPic
shp.ScaleHeight因子:= 1,RelativeToOriginalSize:= msoTrue
shp.ScaleWidth因子:= 1,RelativeToOriginalSize = msoTrue
由于您继续添加新的p图片,默认情况下,它被放在 ZOrder
的顶部。
尝试在末尾添加此行:
shp.ZOrder msoSendToBack
这应该把照片放回你想要的地方...在后面。
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:
shp.ZOrder msoSendToBack
This should put the picture back where you want it to be... in the back.
这篇关于excel 2007图像不会回来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!