add image as comment VBA

前端 未结 6 1344
小蘑菇
小蘑菇 2021-01-16 14:54

I found this code to insert images into excel 2013 but the images are large than the cells they\'re going into. I think the best option it to load the images as comments.

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-16 15:25

    If you want your images to match your destination cell height size use:

    With shp
        .LockAspectRatio = msoTrue
        '.Width = Cells(cell.Row, cell.Column + 5).Width 'Uncomment this  line and comment out .Height line to match cell width
        .Height = Cells(cell.Row, cell.Column + 5).Height 
        .Cut
    End With
    

    If you want to match both cell with and height use:

    With shp
        .LockAspectRatio = msoFalse
        .Width = Cells(cell.Row, cell.Column + 5).Width
        .Height = Cells(cell.Row, cell.Column + 5).Height
        .Cut
    End With
    

提交回复
热议问题