本文介绍了通过VB将图像添加到Excel注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在向Excel电子表格的评论中添加图片时遇到问题。下面的代码附加图像,但宽度和高度不正确。对于比它们更高的图像
,在应用高度值时,它往往使宽度几乎为0。对于比它们更宽的图像,评论(图像)大多是正确的,但宽高比不正确。
对我错过的任何想法?
Sub AddPictureComment(ByVal strPartName As String, ByVal intExcelRow As Integer, ByRef xlsWorkSheet As Object)
'~~> Set what needs to go into comments
Dim strPartImageName As String = strFilePath & strPartName & ".jpg"
Dim bmpImageForSize As New Bitmap(strPartImageName)
'~~> Verify/Record the information
lw.Writeline("Cell: A" & intExcelRow)
lw.Writeline(" -Image : " & strPartImageName)
lw.WriteLine(" -Height : " & bmpImageForSize.height)
lw.WriteLine(" -Width : " & bmpImageForSize.width)
lw.WriteLine("")
'~~> Add the comment
With xlsWorkSheet.Range("A" & intExcelRow).AddComment(strPartName)
.Shape.Height = bmpImageForSize.Height
.Shape.Width = bmpImageForSize.Width
.Shape.Fill.UserPicture(strPartImageName)
End With
End Sub
推荐答案
Jim Cone
美国俄勒冈州波特兰市
https://goo.gl/IUQUN2 (Dropbox)
美国俄勒冈州波特兰市
https://goo.gl/IUQUN2 (Dropbox)
Jim Cone
Portland, Oregon USA
https://goo.gl/IUQUN2 (Dropbox)
Portland, Oregon USA
https://goo.gl/IUQUN2 (Dropbox)
这篇关于通过VB将图像添加到Excel注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!