excel 將圖片的鏈接URL 顯示為圖片 轉


原帖: http://www.mrexcel.com/forum/excel-questions/604604-insert-image-url-images-into-cells-2.html
1. 如下VBA腳本將c1單元格內圖片url鏈接在單元B1內把圖片顯示出來

 

Sub  Test()
    Dim Pic  As Picture

    Application.ScreenUpdating = False
    With ActiveSheet.Range("C1")
        Set Pic = .Parent.Pictures.Insert(.Value)
        With .Offset(, -1)
            Pic.Top = .Top
            Pic.Left = .Left
            Pic.Height = .Height
            Pic.Width = .Width
        End With
    End With
    Application.ScreenUpdating = True
End Sub  

 

 2. 整列的圖片url顯示為圖片

Sub Test()
     Dim Rng  As Range
     Dim Cell  As Range
     Dim Pic  As Picture
    Application.ScreenUpdating =  False
     Set Rng = Range( " C1:C " & Range( " c " & Rows.Count).End(xlUp).Row)
     For  Each Cell  In Rng
         With Cell
             Set Pic = .Parent.Pictures.Insert(.Value)
             With .Offset(, - 1)
                Pic.Top = .Top
                Pic.Left = .Left
                Pic.Height = .Height
                Pic.Width = .Width
             End  With
         End  With
     Next Cell
    Application.ScreenUpdating =  True

End Sub 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM