Image recolor with VBA

N

Nik

Hi all,

does anybody know what's the VBA method to obtain the same effect of
recoloring a bitmap inserted on a worksheet ? if you place a picture
on a sheet with Insert | Picture, then right click on it and select
Picture format | Picture | Recolor (select anyone) the picure is
recolored applying a transparent layer of the selected color on it.
How to obtain the same effect with VBA ? I cannot find the right
method.
thanks in advance
Nik

PS : I'am using XL2007 in Italian, command translations could be
slightly different, sorry
 
G

GS

Nik explained :
Hi all,

does anybody know what's the VBA method to obtain the same effect of
recoloring a bitmap inserted on a worksheet ? if you place a picture
on a sheet with Insert | Picture, then right click on it and select
Picture format | Picture | Recolor (select anyone) the picure is
recolored applying a transparent layer of the selected color on it.
How to obtain the same effect with VBA ? I cannot find the right
method.
thanks in advance
Nik

PS : I'am using XL2007 in Italian, command translations could be
slightly different, sorry

Did you try using the macro recorder?
 
M

Martin Brown

Nik explained :

Did you try using the macro recorder?

On XL2007 ? You have to be kidding. It is complete junk on that version.

If you are *very* lucky it might at best produce something that is
syntactically valid called Macro1() but doesn't work and at worst it
will crash at runtime in a hopeless mess.

I'd hazard a guess it is something in or near .ShapeRange.Fill but it
may require some trial and error on your part to find it and make it
behave as you would like. Don't expect any help from the help system :(

Regards,
Martin Brown
 
G

GS

Martin Brown used his keyboard to write :
On XL2007 ? You have to be kidding. It is complete junk on that version.

If you are *very* lucky it might at best produce something that is
syntactically valid called Macro1() but doesn't work and at worst it will
crash at runtime in a hopeless mess.

I'd hazard a guess it is something in or near .ShapeRange.Fill but it may
require some trial and error on your part to find it and make it behave as
you would like. Don't expect any help from the help system :(

Regards,
Martin Brown

Well stated!
I'd probably use an earlier version and record manual steps just to get
the right object refs, then rewrite into something more formidable.<g>
 
N

Nik

I did try to use the 2007 macro recorder, nothing gets recorded
unfortunately. I also tried 2003 but that method wasn't available at
that time.Thanks for suggesting. ShapeRange.Fill, I'll try that too.
Nik
 
I

isabelle

hi Nik and All,

the following code works on XL2002, i hope it will work for xl2007

Sub Macro1()
With Worksheets(1).Shapes("Picture 1").Fill
.Visible = True
.BackColor.RGB = RGB(170, 170, 170)
.Transparency = 0.99
End With
End Sub
 
N

Nik

Thank you Isabelle,

Your code seems formally correct, no errors in macro, but when run
nothing happens.
Nik
 
T

tubamantom

niksapTOGLIMI wrote on 05/06/2011 18:03 ET
Hi all

does anybody know what's the VBA method to obtain the same effect o
recoloring a bitmap inserted on a worksheet ? if you place a pictur
on a sheet with Insert | Picture, then right click on it and selec
Picture format | Picture | Recolor (select anyone) the picure i
recolored applying a transparent layer of the selected color on it
How to obtain the same effect with VBA ? I cannot find the righ
method
thanks in advanc
Ni

PS : I'am using XL2007 in Italian, command translations could b
slightly different, sorr
I struggled big time with this too in WORD. Had to use some rather trick
approaches to doing the macro record but I got it done - don't remember no
wha
I did
In Word, here is the command that I learned from the record
Selection.InlineShapes(1).PictureFormat.ColorType = msoPictureGrayscal
Works beautifully and it makes the nicest gray scale picture (from color) o
everything else I tried
In my case I used this about a hundred times in one file, each in a separat
Text box but each time I used InLineShapes(1)
(I am somewhat shocked at the gross absence of information on this command.
sure spent a lot of time getting to this point.
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top