Insert Size Shape and Transparent Background Image

alexg7828

New Member
Joined
Aug 4, 2017
Messages
21
I am making progress. At the moment I can add an image to a cell, size it to a specific range but thats where I am stuck.

Now I would like to be able to select an image in a specific range and change the background colour (white) to transparent. Any ideas?

My attempt is in red below

Code:
LookupOCMsignature


If Dir(OCMsignaturePath) <> vbNullString Then


With ActiveSheet.Pictures.Insert(OCMsignaturePath)
    If .Width / .Height < 2.575 Then
     .Top = Range("OCMsignature").Top + 1
     .Height = Range("OCMsignature").MergeArea.Height - 1
     .Left = Range("OCMsignature").Left + (Range("OCMsignature").MergeArea.Width - .Width) / 2
     .ShapeRange.LockAspectRatio = msoTrue
     Else
     .Left = Range("OCMsignature").Left + 1
     .Width = Range("OCMsignature").MergeArea.Width - 1
     .Top = Range("OCMsignature").Top + (Range("OCMsignature").MergeArea.Height - .Height) / 2
     .ShapeRange.LockAspectRatio = msoTrue
     End If
End With
[COLOR=#ff0000]
[/COLOR]
[COLOR=#ff0000]    For Each Picture In ActiveSheet.Pictures[/COLOR]
[COLOR=#ff0000]        If Not Intersect(pic.TopLeftCell, Range("A488:E500")) Is Nothing Then[/COLOR]
[COLOR=#ff0000]            .PictureFormat[/COLOR]
[COLOR=#ff0000]            .TransparentBackground = True[/COLOR]
[COLOR=#ff0000]            .TransparencyColor = vbWhite[/COLOR]
[COLOR=#ff0000]        .Fill.Visible = False[/COLOR]


Else
If dispMsgBox = True Then
MsgBox OCMsignaturePath & vbCrLf & "This link to the image is not available. Please check the availability of the file in the right directory"
End If
End If


End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,147,499
Messages
5,741,511
Members
423,663
Latest member
kaveh87rsh

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
Top