将图像添加为评论VBA [英] add image as comment VBA
本文介绍了将图像添加为评论VBA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现这个代码将图像插入到excel 2013中,但是图像比它们进入的单元格大。我认为将图像加载为评论的最佳选择。
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.
以下是否有人可以修改此VBA作为评论?
Can someone modify this VBA below to add this as a comment?
Sub URLPictureInsert()
Dim cell, shp As Shape, target As Range
Set rng = ActiveSheet.Range("R2:R5") ' range with URLs
For Each cell In rng
filenam = cell
ActiveSheet.Pictures.Insert(filenam).Select
Set shp = Selection.ShapeRange.Item(1)
With shp
.LockAspectRatio = msoTrue
.Width = 50
.Height = 50
.Cut
End With
Cells(cell.Row, cell.Column + 5).PasteSpecial
Next
End Sub
推荐答案
我相信以下链接有您要查找的内容
I believe The following link has what you are looking for
http://en.kioskea.net/faq/8619-excel-a-acacro -to-auto-insert-image-in-a-comment-box
Sub Img_in_Commentbox()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False 'Only one file
.InitialFileName = CurDir 'directory to open the window
.Filters.Clear 'Cancel the filter
.Filters.Add Description:="Images", Extensions:="*.jpg", Position:=1
.Title = "Choose image"
If .Show = -1 Then TheFile = .SelectedItems(1) Else TheFile = 0
End With
'No file selected
If TheFile = 0 Then
MsgBox ("No image selected")
Exit Sub
End If
Range("A1").AddComment
Range("A1").Comment.Visible = True
[A1].Comment.Shape.Fill.UserPicture TheFile
End Sub
这篇关于将图像添加为评论VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文