Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-02-2018, 09:53 PM
laddiator laddiator is offline Linked Image Cannot Be Displayed Windows 10 Linked Image Cannot Be Displayed Office 2016
Novice
Linked Image Cannot Be Displayed
 
Join Date: Apr 2018
Posts: 1
laddiator is on a distinguished road
Default 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
Thanks!
Reply With Quote
  #2  
Old 04-03-2018, 05:44 AM
p45cal's Avatar
p45cal p45cal is offline Linked Image Cannot Be Displayed Windows 10 Linked Image Cannot Be Displayed Office 2010 32bit
Expert
 
Join Date: Apr 2014
Posts: 863
p45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant future
Default

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
Reply With Quote
Reply

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
Linked Image Cannot Be Displayed 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

Other Forums: Access Forums

All times are GMT -7. The time now is 06:07 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft