Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
excelvba图像_Excel_Vba - Fatal编程技术网

excelvba图像

excelvba图像,excel,vba,Excel,Vba,我有大约十张图片,但是我想根据用户从组合框中的选择选择四张或五张。但是,我想知道如何确保拾取的图像与ComboBox的标签匹配。把图像保存在excel表格上可以吗?这就是为什么我不想要下面的样式。可以调整图像的大小吗 Sub update_data() Sheet1.Cells(2, 2) = Sheet1.ComboBox1.Value Sheet1.Image1.Picture = LoadPicture(VBAProject.ThisWorkbook.Path & "\

我有大约十张图片,但是我想根据用户从组合框中的选择选择四张或五张。但是,我想知道如何确保拾取的图像与ComboBox的标签匹配。把图像保存在excel表格上可以吗?这就是为什么我不想要下面的样式。可以调整图像的大小吗

Sub update_data()
   Sheet1.Cells(2, 2) = Sheet1.ComboBox1.Value
   Sheet1.Image1.Picture = LoadPicture(VBAProject.ThisWorkbook.Path & "\pics\" &      Sheet1.ComboBox1.Value & ".jpg")
End Sub

您可以使用if-then选择

比如说

If range("a1") = "Your Value" Then 
Range("A1").select 
Activesheet.Pictures.insert and your file path.