Replace the Picture within an Image Control with Picture: (None)

PeterMac65

New Member
Joined
May 7, 2020
Messages
17
Office Version
  1. 365
Platform
  1. Windows
Hi
I have a series of ActiveX Images in a worksheet that i wish to remove the contents
The Images have names eg "North", "South" etc

I'm looking for VBA code to replace the contents with Null ie, Picture = (None)
1620165033999.png
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
VBA Code:
Sub Test()
  Dim s As OLEObject
  Set s = Worksheets(1).OLEObjects("North")
  s.Object.Picture = LoadPicture("")
End Sub
 
Upvote 0
Solution
Thanks Kenneth for the help.
I've included my code below

Sub ClearOLEObjects()
Dim s As OLEObject
Set s = Worksheets("Cost").OLEObjects("North")
End Sub
 
Upvote 0
You can clear (remove the picture, leave the control) the Image control with just a single line of code (no other supporting code is required)...
VBA Code:
Set Worksheets("Cost").OLEObjects("North").Object.Picture = Nothing
 
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,381
Members
448,888
Latest member
Arle8907

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