返回列表 上一主題 發帖

請教關於圖片顯示的語法?

回復 1# tku0216
移動滑鼠點選  儲存格上 有圖片檔案名稱  會顯示 該檔案名稱的圖片
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)   '該工作表的事件 程序
  2.     Dim xPath As String
  3.     On Error Resume Next
  4.     xPath = "d:\"                                       '修改為圖片檔 的路徑資料夾
  5.     [xlTarget].ClearComments
  6.     If Target(1) = "" Then Exit Sub
  7.     If Dir(xPath & Target) = "" Then Exit Sub
  8.     Target.Name = "xlTarget"
  9.     [xlTarget].NoteText " "
  10.     With Target.Comment.Shape           '儲存格註解文字圖案
  11.         .TextFrame.Characters.Font.ColorIndex = 1
  12.         .TextFrame.Characters.Font.Size = 14
  13.         .Fill.ForeColor.SchemeColor = 13
  14.         .AutoShapeType = msoShapeRectangle
  15.         .Line.ForeColor.SchemeColor = 53
  16.         .Line.Weight = 2
  17.         .Fill.UserPicture xPath & Target
  18.         .ScaleWidth 4, 0
  19.         .ScaleHeight 3, 0
  20.         .Visible = True
  21.     End With
  22. End Sub
複製代碼
如圖
   

TOP

        靜思自在 : 做該做的事是智慧,做不該做的事是愚癡。
返回列表 上一主題