使用ActiveX Image Control时,在excel中有.jpg文件 [英] Have .jpg files within excel when using ActiveX Image Control

查看:337
本文介绍了使用ActiveX Image Control时,在excel中有.jpg文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个excel文件与几个切换按钮。当切换按钮打开并且按下计算命令按钮时,我的activeX图像帧会发生变化。但是,我将所有这些文件放在同一目录中,所以我必须将文件发送给我的员工压缩。有没有喜欢可能将它们加载到隐藏工作表中的excel工作簿?



谢谢

解决方案

我认为LoadPicture()函数将寻找一个系统文件,所以你不希望这样。



将图片添加到图像中在工作表上。这样他们将在工作簿中。





然后右键单击您刚才添加的图像并选择属性。选择图片属性并导航到您的图像文件。





您可以更改名称,以使您的图片也有意义。所以他们不必是Image1 Image2等。



然后在你的代码中设置你想要更改的图片=你想要的图像。

 如果有东西
Image1.Picture = Image2.Picture
Else
Image1.Picture = Image3.Picture
结束如果

这里Image1是根据计算按钮为什么会发生什么变化的图片按下。 Image3是您加载到工作簿中的图像之一。



如果要将其存储在其他工作表上,您可能需要声明一个工作表对象并设置它

  Dim ws As Excel.Worksheet 
设置ws = ActiveWorkbook.Sheets(ImageWorksheet)
Image1.Picture = ws.Image3.Picture

或类似的东西可能会起作用。 >

  ActiveWorkbook.Sheets(ImageWorksheet)。Image3.Picture 

这样的东西。


I have an excel file with several toggle buttons. When a toggle button is on and the "calculate" command button is pressed, my activeX image frame changes. However, I have all these files in the same directory so I'd have to send the file to my employees zipped. Is there anyway to like maybe load them into the excel workbook on a hidden sheet?

Thank you

解决方案

I think the LoadPicture() function will look for a system file so you don't want that.

Add the pictures into images on a worksheet. This way they will be in the workbook.

Then right click the image you just added and select properties. Select picture property and navigate to your image file.

You can change the name to make sense of your pictures also. So they don't have to be Image1 Image2 etc.

Then in your code set the picture that you want to change = the image that you want.

If something
    Image1.Picture = Image2.Picture
Else
    Image1.Picture = Image3.Picture
End If

Here Image1 is the picture that changes based on what happens when the calculate button is pressed. Image3 is one of the images that you loaded into the workbook.

If you are going to store them on some other worksheet you may need to declare a worksheet object and set it to that sheet

Dim ws As Excel.Worksheet
Set ws = ActiveWorkbook.Sheets("ImageWorksheet")
Image1.Picture = ws.Image3.Picture

or something like this may work.

ActiveWorkbook.Sheets("ImageWorksheet").Image3.Picture

Something like that.

这篇关于使用ActiveX Image Control时,在excel中有.jpg文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆