Hide/Unhide multiple pictures in Excel

jouri_ph

New Member
Joined
Mar 16, 2020
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I'm kinda new to the whole VBA world and I have trouble with writing a code for hiding and unhiding pictures when a commandbutton is pressed.

I work for a maintenance company and we also work for multiple different other companies.
What I would like to do with our existing report is to hide and unhide different logo's of these companies, so that I don't have to manually add or remove these logo's after your done with filling in the report.
I would also like the colors of some text lines to change with it.
These commandbutton choices will (hopefully ) be added to a existing userform in the beginning of the report.

I hope someone can help me with this issue.

Best regards,

Jouri
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I would use ActiveX Image Control to be able to load an image file dynamically.
You can insert the Image control via Ribbon -> Developer -> Insert.
See following article to enable the Developer ribbon tab and create an image control.

Then all you need single line of code to load the image file:
Sample code line for loading logo1.jpg image file into the image control called as Image1 in Sheet1.
VBA Code:
Sheet1.Image1.Picture = LoadPicture("C:\Users\smozgur\Desktop\images\logo1.jpg")

You can then basically use this code line with different file names in different command button click event procedures.
 
Upvote 0
Dear Smozgur,

Thank you for your response!
But would this also work on other pc's?
This report will be used on many other pc's.
If not, would it also be possible to choose a directory on a cloud based storage like Gdrive?
 
Upvote 0

Forum statistics

Threads
1,214,861
Messages
6,121,973
Members
449,059
Latest member
oculus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top