ActiveSheet.Pictures.Insert problem in excel 2007

M

Marvin

The following macro worked fine for years in 2003..
Range("E16").Select
' Get Client / Summary Menu CMA Picture

ActiveSheet.Pictures.Insert("C:\CRISNET\EXPORT\CMA_Picture_Group\CMA_Picture.jpg").Select

In 2007 it places the picture in B4 consistently even if I use a range
command for another location
 
J

Jon Peltier

Try this:

Sub InsertAndMovePicture(sPicturePathAndFilename As String, sCellAddress As
String)
With ActiveSheet.Pictures.Insert(sPicturePathAndFilename)
.Left = ActiveSheet.Range(sCellAddress).Left
.Top = ActiveSheet.Range(sCellAddress).Top
End With
End Sub

- Jon
 
J

Jon Peltier

This is so minor compared to other issues, I would not expect it to be
addressed.

- Jon
 
M

Marvin

Jon, I have multiple named pictures on the page and they end up piled
together. Is there a way to adjust each picture by name?
 
J

Jon Peltier

Sub InsertAndMovePicture(sPictureName As String, sCellAddress As String)
With ActiveSheet.Pictures(sPictureName)
.Left = ActiveSheet.Range(sCellAddress).Left
.Top = ActiveSheet.Range(sCellAddress).Top
End With
End Sub


- Jon
 
M

Marvin

This works Great! Thanks

Sub InsertAndMovePicture(sPictureName As String, sCellAddress As String)
'InsertAndMovePicture Macro Written by
'Jon Peltier, Microsoft Excel MVP
'Tutorials and Custom Solutions
'Peltier Technical Services, Inc. - http://PeltierTech.com
'02/25/08
'
With ActiveSheet.Pictures(sPictureName)
.Left = ActiveSheet.Range(sCellAddress).Left
.Top = ActiveSheet.Range(sCellAddress).Top
End With
End Sub
Sub CallMovePicture()

ActiveSheet.Pictures.Insert("C:\CRISNET\EXPORT\CMA_Picture_Group\CMA_Picture.jpg").Select
Selection.Name = "Picture-1"
Application.Run "InsertAndMovePicture", "Picture-1", "A1"
End Sub
 

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