Office中国论坛/Access中国论坛

标题: (以解決)批註插入圖片的宏可否增加圖片連接單獨打開圖片 [打印本页]

作者: joyark    时间: 2011-6-15 03:25
标题: (以解決)批註插入圖片的宏可否增加圖片連接單獨打開圖片
本帖最后由 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


作者: roych    时间: 2011-6-15 10:01
在最后一句加上这一句看看?
ActiveSheet .Hyperlinks.Add ActiveCell, Pict, , , Pict
在2010版本测试没问题。

作者: joyark    时间: 2011-6-15 12:52
謝謝幫忙




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3