#1
|
|||
|
|||
Linked Image Cannot Be Displayed
Looks like just a link is being saved when I use this. Did some research and it looks like I need to insert the pictures into a shape instead. Can anyone help me with that?
Here's what I have right now. It works perfectly until I try to send it. Code:
Sub InsertPictures() Dim vFilename As Variant Dim oPic As Picture Dim StartRow As Long Dim StartCol As Long Dim NumCols As Long Dim i As Long Dim r As Long Dim c As Long vFilename = Application.GetOpenFilename( _ FileFilter:="Pictures (*.gif;*.jpg;*.png), *.gif;*.jpg;*.png", _ Title:="Select Picture", _ MultiSelect:=True) If Not IsArray(vFilename) Then Exit Sub StartRow = 8 StartCol = 1 NumCols = 4 r = StartRow c = StartCol For i = LBound(vFilename) To UBound(vFilename) Set oPic = ActiveSheet.Pictures.Insert(vFilename(i)) With oPic .ShapeRange.LockAspectRatio = msoFalse .Left = Cells(r, c).Left .Top = Cells(r, c).Top .Width = Cells(r, c).Width .Height = Cells(r, c).Height End With If i Mod NumCols = 0 Then r = r + 2 c = StartCol Else c = c + 2 End If Next i End Sub |
#2
|
||||
|
||||
Ditch Opic and:
Code:
Sub InsertPictures() Dim vFilename As Variant Dim StartRow As Long Dim StartCol As Long Dim NumCols As Long Dim i As Long Dim r As Long Dim c As Long vFilename = Application.GetOpenFilename( _ FileFilter:="Pictures (*.gif;*.jpg;*.png), *.gif;*.jpg;*.png", _ Title:="Select Picture", _ MultiSelect:=True) If Not IsArray(vFilename) Then Exit Sub StartRow = 8 StartCol = 1 NumCols = 4 r = StartRow c = StartCol For i = LBound(vFilename) To UBound(vFilename) With ActiveSheet.Shapes.AddPicture(vFilename(i), Linktofile:=msoFalse, SaveWithDocument:=msoTrue, Left:=Cells(r, c).Left, Top:=Cells(r, c).Top, Width:=Cells(r, c).Width, Height:=Cells(r, c).Height) .LockAspectRatio = msoFalse End With If i Mod NumCols = 0 Then r = r + 2 c = StartCol Else c = c + 2 End If Next i End Sub |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to determine an image's linked/inserted status? | Orthoducks | Word | 1 | 11-23-2016 04:00 PM |
how to batch update linked image files path? | stanleyhuang | Word | 3 | 09-11-2014 12:51 AM |
image cannot currently be displayed | geddit | PowerPoint | 1 | 06-18-2012 09:26 AM |
'this image cannot currently be displayed' | eNGiNe | Word | 0 | 02-02-2012 07:58 AM |
Linked Image automatic update? | uzapuca | PowerPoint | 0 | 04-23-2011 02:03 AM |