Embedding An Active Photo Path?

NW Jeeper

New Member
Joined
Nov 21, 2016
Messages
6
Howdy,
This is what I am trying to do....I have a part spec list and I also have photos of each part in separate files. The spec list utilizes vlookup formulas to recall the specs from the data sheet. I would like a photo to be included on the sheet. Since the path to the photos are all the same except for the title which is the part number, I can easily create the correct a variable path utilizing a formula. What I was trying to do was create a macro that would copy and paste the path into inserting the photo and I can't seem to get it to work. It will do it for the first example recorded into the macro but as you change the path the macro will not change with it because when it is recording it is saving what is in the cell at that time instead of the cell location so that it could be variable. Unfortunately I do not know enough about editing macros to be able to change this to what is needed. I have copied a sample of the macro below and will blue highlight where I believe the problem lies:

Sub SpecPhotoMacro()
'
' SpecPhotoMacro Macro
'
' Keyboard Shortcut: Ctrl+Shift+Z
'
Range("D6").Select
Selection.Copy
Range("D9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
ActiveSheet.Pictures.Insert( _
"C:\Users\rboevers\Pictures\New folder\image6.jpeg").Select
Selection.ShapeRange.ScaleWidth 0.6123737374, msoFalse, msoScaleFromBottomRight
Selection.ShapeRange.ScaleHeight 0.6123737374, msoFalse, _
msoScaleFromBottomRight
Selection.ShapeRange.IncrementLeft -330
Selection.ShapeRange.IncrementTop -181.5
Selection.ShapeRange.ScaleWidth 0.6371132397, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.6371131856, msoFalse, _
msoScaleFromBottomRight
Selection.ShapeRange.IncrementLeft 24
Selection.ShapeRange.IncrementTop -105
End Sub


Maybe there is an easier way of going about this?
Any/all help with this is greatly appreciated!!

Take care, Rick.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I have copied below a much simpler way of looking at it;

Sub PartPhoto()
'
' PartPhoto Macro
'
' Keyboard Shortcut: Ctrl+Shift+A
'
Range("E4").Select
Selection.Copy
ActiveSheet.Shapes.Range(Array("Picture 12")).Select
End Sub

This macro will copy from the correct cell but then always pastes the same thing when pasting to "Change Picture" file name, I believe it is because of the "Picture 12" is not what is being copied from "E4" but I am not familiar enough with these to know how to change it to make it work. Any/all help is very appreciated.


Thanks, Rick.







Howdy,
This is what I am trying to do....I have a part spec list and I also have photos of each part in separate files. The spec list utilizes vlookup formulas to recall the specs from the data sheet. I would like a photo to be included on the sheet. Since the path to the photos are all the same except for the title which is the part number, I can easily create the correct a variable path utilizing a formula. What I was trying to do was create a macro that would copy and paste the path into inserting the photo and I can't seem to get it to work. It will do it for the first example recorded into the macro but as you change the path the macro will not change with it because when it is recording it is saving what is in the cell at that time instead of the cell location so that it could be variable. Unfortunately I do not know enough about editing macros to be able to change this to what is needed. I have copied a sample of the macro below and will blue highlight where I believe the problem lies:

Sub SpecPhotoMacro()
'
' SpecPhotoMacro Macro
'
' Keyboard Shortcut: Ctrl+Shift+Z
'
Range("D6").Select
Selection.Copy
Range("D9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
ActiveSheet.Pictures.Insert( _
"C:\Users\rboevers\Pictures\New folder\image6.jpeg").Select
Selection.ShapeRange.ScaleWidth 0.6123737374, msoFalse, msoScaleFromBottomRight
Selection.ShapeRange.ScaleHeight 0.6123737374, msoFalse, _
msoScaleFromBottomRight
Selection.ShapeRange.IncrementLeft -330
Selection.ShapeRange.IncrementTop -181.5
Selection.ShapeRange.ScaleWidth 0.6371132397, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.6371131856, msoFalse, _
msoScaleFromBottomRight
Selection.ShapeRange.IncrementLeft 24
Selection.ShapeRange.IncrementTop -105
End Sub


Maybe there is an easier way of going about this?
Any/all help with this is greatly appreciated!!

Take care, Rick.[/QUOTE]
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,897
Members
449,194
Latest member
JayEggleton

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