|
本帖最后由 joyark 于 2011-6-15 12:55 编辑
批註插入圖片的宏可否增加圖片連接單獨打開圖片
希望各位幫忙寫出相關的宏
問題1.批註插入圖片的宏
2.圖片插入後,能否加上超連結打開圖片的宏
謝謝各位幫忙
'批註插入圖片的宏
Option Explicit
Const ImgFileFormat = "Image Files (*.bmp;*.gif;*.tif;*.jpg;*.jpeg)," & _
"*bmp;*gif;*.tif;*.jpg;*.jpeg"
'--------------------------------------------------------------------------------
Sub AddPicturesToComments() '插入备注图片
Dim HasCom
Dim Pict As String
Dim ans As Integer
Set HasCom = ActiveCell.Comment
If Not HasCom Is Nothing Then ActiveCell.Comment.Delete
Set HasCom = Nothing
GetPict:
Pict = Application.GetOpenFilename(ImgFileFormat)
If Pict = "False" Then End
ans = MsgBox("Open : " & Pict, vbYesNo + vbExclamation, "Use this Picture?")
If ans = vbNo Then GoTo GetPict
With ActiveCell
.AddComment
.Comment.Visible = False
.Comment.Shape.Fill.Transparency = 0#
.Comment.Shape.Fill.UserPicture Pict
End With
ActiveCell.Select
ActiveCell.Comment.Shape.ScaleWidth 3, msoFalse, msoScaleFromTopLeft
ActiveCell.Comment.Shape.ScaleHeight 4, msoFalse, msoScaleFromTopLeft
ActiveSheet.Hyperlinks.Add ActiveCell, Pict, , , Pict
End Sub
|
|