Otherwise any code to break a link of linked image in excel. (getting error if i move/copy excel from one folder to another and when i delete photos from folder, image place it is showing above error ) ?
Posts by Yuvi0007
-
-
Yes if i delete a photo from folder image has to be in Excel ....but now its giving error. photos need to add as like copy paste nots link.
-
Same error is shown once i delete image from folder "The linked image cannot be displayed. the file may have been moved, renamed, or deleted verify that the link points the correct file and location" and also it is not adjusting with Cell Size. I am attaching Excel file provide code.
Thank you.
-
yes.....you provided code.
but that is different. Where I am adding photos from user form to excel.
But this thread is different..in this, I am calling images from folder to excel based on cell "A" value..my code is working but I am not able to add a static image/shapes.addpicture.
-
I have few photos with Names and saved in one folder. also i have excel where Photos Names are in Cell"A" and i want to map these photos in Cell "B" (copy paste). i can able to do it by above code but once i move excel or photos it giving error "The linked image cannot be displayed. the file may have been moved, renamed, or deleted verify that the link points the correct file and location"
so if there is any other code to paste photos in cell"B" based on Cell "A" Values ?
-
Hi.
need solution on below code .
ex: If i type xyz in cell "A" the code has to call xyz image from folder and paste in cell "B"
I am using below code but once I move excel or delete photos form folder showing error.The linked image cannot be displayed. the file may have been moved, renamed, or deleted verify that the link points the correct file and location"
Can we modify below code by Shapes.AddPicture Or any other static image code ?
Code
Display MorePrivate Sub Worksheet_change(ByVal Target as Range) Dim shp As Shape If Intersect (Target,[A:A]) Is Nothing Then Exit Sub If Target.Row Mode 20=0 Then Exit Sub On Error Go to son For Each shp In ActiveSheet.Shapes If shp.Type =msoPicture And shp.TopLeftCell.Address= Target.Offset(0,1).Address Then shp.Delete Next ActiveSheet.Pictures.Insert (Thisworkbook.Path &"\"& Target.Value &".JPG").Select Selection.Top=Target.Offset(0,1).Top Selection.Left = Target.Offset(0,1).left With Selection.ShapRange .LockAspectRatio = msoFalse .Height = Target.Offset (0,1).Height .Width = Target.Offset(0,1).Width End With Target.offset(1,0).Select son: End Sub
-
Thank you very much .....Thread resolved
-
-
I am new ... VBA Coding ... so not able to solve few errors .any solution Code for above problem ?
-
Hi... find the excel check the Code.
ex. Name in cell"A", image in Cell"B"(Shapes.AddPicture), Year in Cell "C" ...
solution ???
-
I tried but not able to code . so many errors are coming ex. variable not defined , run time error ,out of memory etc.
????
-
I coded this for on page where VBA will check for empty line and then Text A will go in Cell "A" and Text C will go in cell "C" for next entry it comes in new line and perform same . But i want to code like Text A In cell "A" and Image by using Shapes.AddPicture in Cell "B" ,text C in Cell"C". For next entry same for next row.
Is it possible to code for above? any solution ?
-
Thanks Rory .. The code is working fine without error ... Thank you .
my one more query ?
can i add the image in this position cell "B"
Ex;
CodeOption Explicit Dim fpath As String Private Sub Save_Click() Dim x As Long Dim Y As Worksheet Set Y = Sheets("Data1") x = Y.Range("A" & Rows.Count).End(xlUp).Row With Y .Cells(x + 1, "A").Value = TextA.Text .Cells(x + 1, "B").Image =sht.Shapes.AddPicture p, msoFalse, msoTrue, ActiveCell.Left, ActiveCell.Top, -1, -1
In cell "B" ?
-
since last one month i am trying to add images in excel with different code but i am facing this error:"The linked image cannot be displayed. the file may have been moved, renamed, or deleted verify that the link points the correct file and location"
Is there no solution for this problem/error ? If any one know how to paste image from user form to excel. give example code....
-
Hi
I tried with Shapes.AddPicture but its showing error .
you have any example code ?
-
I tried above code Its work fine.
1) But Problem is once you close excel and reopen the image disappearance and gives message "The linked image cannot be displayed. the file may have been moved, renamed, or deleted verify that the link points the correct file and location"
2) I am not able to paste it in particular cell .
any solution ? -
Yes your code works fine. but i wanted to add image based on cell A "text" = image "name" in folder.
any solution?
-
Really Great solution .... It's inserting image from userform to Excel.
by using below code I tried my best to insert image in particular cell but I am fail.
Ex; value Text A is pasting in cell A but I tried to insert picture in B but when i modified program its showing Error.
The Code works fine if i want the image only in excel... but i want Image in Cell B
any solution ?
Code
Display MoreOption Explicit Dim fpath As String Private Sub Save_Click() Dim x As Long Dim Y As Worksheet Set Y = Sheets("Data1") x = Y.Range("A" & Rows.Count).End(xlUp).Row With Y .Cells(x + 1, "A").Value = TextA.Text .Cells(x + 1, "B").Paste = TransferToSheet Me.Image1, ActiveWorkbook.Sheets(1) .Cells(x + 1, "C").Value = TextC.Text .Cells(x + 1, "D").Value = TextD.Text .Cells(x + 1, "E").Value = TextE.Text .Cells(x + 1, "F").Value = TextF.Text .Cells(x + 1, "G").Value = TextG.Text End With Dim i As String i = TextPart.Text FileCopy fpath, "C:\\Users\HP\Desktop\Userform\\" & i & ".JPG" Me.TextPart.Text = "" 'clear the data TextA.Text = "" TextC.Text = "" TextD.Text = "" TextE.Text = "" TextF.Text = "" TextG.Text = "" fpath = "" Image1.Picture = LoadPicture("") End Sub
I tried in different way but showing Error
ex: below line
-
Hi...Thank for Code.
I used above code but its help to only copy paste.
Actually Buy using below code based on cell [A:A] value i can able to auto call image from file and inserting in next cell in excel.
ex: If I Type 0007 in cell A1 then micro check for image in file, name 0007.JPG and it Inserts it in Cell B1.
But Problem is, it's Dynamic image , Once i delete photo from file/Folder or if i move a Excel in another location the Cell B1 image will Disapperse with box in Cell B1 as "picture cannot be displayed unlinked or deleted "
Any solution Instead of insert can we insert as copy , Paste as static image in excel , so i can move the excel any folder or location.
Code
Display MorePrivate Sub Worksheet_change(ByVal Target as Range) Dim shp As Shape If Intersect (Target,[A:A]) Is Nothing Then Exit Sub If Target.Row Mode 20=0 Then Exit Sub On Error Go to son For Each shp In ActiveSheet.Shapes If shp.Type =msoPicture And shp.TopLeftCell.Address= Target.Offset(0,1).Address Then shp.Delete Next ActiveSheet.Pictures.Insert (Thisworkbook.Path &"\"& Target.Value &".JPG").Select Selection.Top=Target.Offset(0,1).Top Selection.Left = Target.Offset(0,1).left With Selection.ShapRange .LockAspectRatio = msoFalse .Height = Target.Offset (0,1).Height .Width = Target.Offset(0,1).Width End With Target.offset(1,0).Select son: End Sub
-
By changing text in cell the image has to paste from file.I used below Code it's working fine But once you delete the images from file then the image from excel disappears and showing error. Is it any option instead of Insert can we auto paste in excel.
Code
Display MorePrivate Sub Worksheet_change(ByVal Target as Range) Dim shp As Shape If Intersect (Target,[A:A]) Is Nothing Then Exit Sub If Target.Row Mode 20=0 Then Exit Sub On Error Go to son For Each shp In ActiveSheet.Shapes If shp.Type =msoPicture And shp.TopLeftCell.Address= Target.Offset(0,1).Address Then shp.Delete Next ActiveSheet.Pictures.Insert (Thisworkbook.Path &"\"& Target.Value &".JPG").Select Selection.Top=Target.Offset(0,1).Top Selection.Left = Target.Offset(0,1).left With Selection.ShapRange .LockAspectRatio = msoFalse .Height = Target.Offset (0,1).Height .Width = Target.Offset(0,1).Width End With Target.offset(1,0).Select son: End Sub