返回列表 上一主題 發帖

使用vba如何插入固定大小的圖片

測試使用此方法,發現一個問題
關於列高、欄寬與圖的尺寸有無固定比例
如oobird超版 .Height = 5.3 * 28.35 的28.35 換算公分

Sub Put_Picture_1()

   On Error Resume Next
    For i = 1 To 14
   
   Rows(i).RowHeight = 40  '列高
   Columns(12).ColumnWidth = 40 '欄寬
   
    mm = Format(Cells(i, 11), "0")
   
    Application.Cells(i, 12).Select
   


    With ActiveSheet.Pictures.Insert(ThisWorkbook.Path & "\" & mm & ".jpg")
    .LockAspectRatio = msoFalse
    .Height = 5.3 * 28.35 ' 5.3 cm
    .Width = 5.8 * 28.35 '5.8 cm


    End With

TOP

        靜思自在 : 人的心地是一畦田,土地沒有播下好種子,也長不出好的果實。 -
返回列表 上一主題