更改图像形状的图像 [英] Change the image of an image shape
问题描述
我希望能够通过单击用户表单中的按钮来更改图像形状的图像.
I want to be able to change the image of an image shape by clicking on an button in my userform.
我在网上找到了 UserPicture
函数,但图像只是保持不变.
In the internet I found the function UserPicture
, but the image simply stays the same.
Private Sub ChangeImage_Click()
ActivePresentation.Slides("Slide1").Shapes("SolutionA_Image").Visible = True
ActivePresentation.Slides("Slide1").Shapes("SolutionA_Image").Fill.UserPicture ("D:\User\Desktop\SolutionWrong.jpg")
End Sub
Private Sub HideImage_Click()
ActivePresentation.Slides("Slide1").Shapes("SolutionA_Image").Visible = False
End Sub
当我点击 HideImage
按钮时,形状变得不可见,所以我对形状的选择似乎是正确的.
When I click on the HideImage
button, the shape becomes invisible, so my selection of the shape appears to be right.
我也试过
ActivePresentation.Slides("Slide1").Shapes("SolutionA_Image").Fill.UserPicture "D:\User\SolutionWrong.jpg"
但这也不起作用
编辑
当然我检查了新图片的路径,是正确的.
Edit
Of course I checked the path to the new image, it's correct.
推荐答案
我通过从insert
菜单中选择picture
创建了图像,但它必须通过Insert
=> Rectangular 创建形状
(无边框).现在可以使用 ActivePresentation.Slides("Slide1").Shapes("SolutionA_Image").Fill.UserPicture ("D:\User\SolutionWrong.jpg")
I created the image by selecting picture
from the insert
menu, but it have to be created via Insert
=> Rectangular shape
(no border). Now it can easily be accessed by using ActivePresentation.Slides("Slide1").Shapes("SolutionA_Image").Fill.UserPicture ("D:\User\SolutionWrong.jpg")
这篇关于更改图像形状的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!