macro to load a picture

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
HI your link nothing showing

and how do you want to insert you will put a list of picture name in excel and then macro will lookup that name in your pc folder and then where you want to insert same cell or any other cell ?

pls show some sample
 
Upvote 0
HI TRY BELOW CODE PUT YOUR PICTURE NAME IN CELL A1 AND IT WILL INSERT PHOTO IN CELL B1 YOUR EXCEL PICTURE NAME AND YOUR FOLDER PICTURE NAME MUST BE SAME

THIS AN EXAMPLE YOU CAN LOOP THIS CODE TO INSERT MORE PICTURE LIKE YOU PUT YOUR ALL PICTURE NAME IN COLUMN A AND IT THEN MACRO WILL INSERT PICTURE IN COLUMN B OR WHERE YOU WANTS
IF YOU WANT SOMETHING ELSE THEN LET ME KNOW

Code:
Option Explicit
Sub Insert_Pic()
Dim filename As String
Dim picpath As String
picpath = "F:\PHOTO\ALL PHOTO\" ' Change path to your pc path where is your photo
Range("A1").Select
filename = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
On Error Resume Next
 ActiveSheet.Pictures.Insert(picpath + filename + ".jpg").Select
 Selection.ShapeRange.LockAspectRatio = msoFalse
 Selection.ShapeRange.Height = 100
 Selection.ShapeRange.Width = 134
Selection.Cut
ActiveSheet.Paste
ActiveCell.RowHeight = 100
ActiveCell.ColumnWidth = 25
End Sub
 
Upvote 0
HI TRY BELOW CODE PUT YOUR PICTURE NAME IN CELL A1 AND IT WILL INSERT PHOTO IN CELL B1 YOUR EXCEL PICTURE NAME AND YOUR FOLDER PICTURE NAME MUST BE SAME

THIS AN EXAMPLE YOU CAN LOOP THIS CODE TO INSERT MORE PICTURE LIKE YOU PUT YOUR ALL PICTURE NAME IN COLUMN A AND IT THEN MACRO WILL INSERT PICTURE IN COLUMN B OR WHERE YOU WANTS
IF YOU WANT SOMETHING ELSE THEN LET ME KNOW

Code:
Option Explicit
Sub Insert_Pic()
Dim filename As String
Dim picpath As String
picpath = "F:\PHOTO\ALL PHOTO\" ' Change path to your pc path where is your photo
Range("A1").Select
filename = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
On Error Resume Next
 ActiveSheet.Pictures.Insert(picpath + filename + ".jpg").Select
 Selection.ShapeRange.LockAspectRatio = msoFalse
 Selection.ShapeRange.Height = 100
 Selection.ShapeRange.Width = 134
Selection.Cut
ActiveSheet.Paste
ActiveCell.RowHeight = 100
ActiveCell.ColumnWidth = 25
End Sub
Hi, I have tried this but it's not working...
here is my data
Folder name and location => D:\Images
Excel file name => 500660BHH.JPG
Please help btw do you have a skype id?
 
Upvote 0
Hi, I have tried this but it's not working...
here is my data
Folder name and location => D:\Images
Excel file name => 500660BHH.JPG
Please help btw do you have a skype id?

Hi don't use File Extension in Excel just use like this 500660BHH remove that .JPG and put your file name in Cell A1

so A1 = 500660BHH

and try again it will work
 
Upvote 0
Upvote 0
HI nothing showing in your link and does not matter of Excel version in this macro

please upload your excel with name of photo and that photo folder and also put macro code which you are using any sharing site and paste link here

Here is the macro that I use :

Option Explicit
Sub Insert_Pic()
Dim filename As String
Dim picpath As String
picpath = "D:\Images"
Range("A1").Select
filename = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
On Error Resume Next
ActiveSheet.Pictures.Insert(picpath + filename + ".jpg").Select
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Height = 100
Selection.ShapeRange.Width = 134
Selection.Cut
ActiveSheet.Paste
ActiveCell.RowHeight = 100
ActiveCell.ColumnWidth = 25
End Sub

here is the link for the pictures (2 pictures) :

2013-07-10 28 photo, picture, image on Use.com
 
Upvote 0

Forum statistics

Threads
1,226,693
Messages
6,192,460
Members
453,725
Latest member
cvsdatreas

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