添加图像作为注释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-macro -to-automatically-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屋!
查看全文