2003 macro working in 2007 - inserting a jpeg

D

Dave

I have written the following code which inserts a jpeg file in a cell
(B171)


If Range("R4") = "DW" Then
Range("B171").Value = "Dave Woodgate"
Range("B171").Select
ActiveCell.Select
ActiveSheet.Pictures.Insert("S:\Tsunami Axis\Purchase Orders\Sigs
\Dave Woodgate.JPG").Select
Selection.ShapeRange.PictureFormat.TransparentBackground = msoTrue
Selection.ShapeRange.PictureFormat.TransparencyColor = RGB(255,
255, 255)
Selection.ShapeRange.Fill.Visible = msoFalse
End If


this all works perfectly in 2003, however when the macro is run in
2007 the jpeg is inserted in B4(ish). How do I get it to line up with
the left top of B171? All help appreciated

Thanks

Dave
 
R

Ron de Bruin

In 2007 it not use the position of the acivecell

Use it like this

Dim myPict As Picture

With ActiveSheet.Range("B171")
Set myPict = .Parent.Pictures.Insert("S:\Tsunami Axis\Purchase Orders\Sigs\Dave Woodgate.JPG")
myPict.Top = .Top
myPict.Left = .Left
myPict.Placement = xlMoveAndSize
End With
 
B

Bernard Liengme

Thanks for this, Ron
--
Bernard

Ron de Bruin said:
In 2007 it not use the position of the acivecell

Use it like this

Dim myPict As Picture
With ActiveSheet.Range("B171")
Set myPict = .Parent.Pictures.Insert("S:\Tsunami Axis\Purchase
Orders\Sigs\Dave Woodgate.JPG")
myPict.Top = .Top
myPict.Left = .Left
myPict.Placement = xlMoveAndSize
End With
 

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