|
有興趣的人可以參考我之前做的 插入註解Addin
目前的版本功能較完善了,此版為簡體版
主程式如下
Option Explicit
Dim ComRange As String
Dim ComUserName As String
Dim Commenttext As String
Public ShareID As Integer
Private Sub CommandButton1_Click()
Dim strComment As String, strCount As Integer, strPos As Integer
Application.ScreenUpdating = False
ComRange = ActiveCell.Address(False, False)
ComUserName = TextBox2.Text
Commenttext = TextBox1.Text
If Commenttext = "" Then Exit Sub
On Error Resume Next
Range(ComRange).AddComment
Range(ComRange).Comment.Shape.AutoShapeType = ShareID
Range(ComRange).Comment.Visible = True
If Len(Commenttext) > 0 Then
Range(ComRange).Comment.Text Text:= _
ComUserName & ":" & Chr(10) & Commenttext & Chr(10) & "修改日期:" & Date
End If
Range(ComRange).Comment.Shape.Select
With Selection
.Font.Name = Me.ComboBoxFont.Text
.Font.Size = Me.ComboBoxSize.Text
.AutoSize = True
.ShapeRange.Shadow.ForeColor.SchemeColor = 22
.ShapeRange.Shadow.Type = msoShadow6
.ShapeRange.Shadow.Visible = msoTrue
.ShapeRange.ThreeD.Visible = msoFalse
.ShapeRange.Shadow.Transparency = 0.6
strComment = .Characters.Text
strCount = .Characters.Count
.Characters.Font.ColorIndex = 0
strPos = InStr(1, strComment, ":")
If strPos > 0 Then
.Characters(1, strPos).Font.ColorIndex = 5
.AutoSize = True
End If
strPos = InStr(1, strComment, "修")
If strPos > 0 Then
.Characters(strPos, strCount).Font.ColorIndex = 5
.AutoSize = True
End If
End With
Range(ComRange).Comment.Visible = False
Unload Me
End Sub
Private Sub CmdCmt_Click()
ChangeShareBar
End Sub
Private Sub CommandButton2_Click()
If CommandButton2.Caption = "Option >>" Then
CommandButton2.Caption = "Option <<"
Me.Height = 245
Else
CommandButton2.Caption = "Option >>"
Me.Height = Me.Frame1.Top + 16
End If
End Sub
Private Sub UserForm_Activate()
Me.TextBox1.Text = OldText
Me.Height = Me.Frame1.Top + 16
End Sub
Private Sub UserForm_Initialize()
On Error Resume Next
ListFontSize
TextBox2.Text = GetSetting("JanApp", "Comment", "UserName", Application.UserName)
ShareID = GetSetting("JanApp", "Comment", "Share", 16)
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
On Error Resume Next
SaveSetting "JanApp", "Comment", "UserName", TextBox2.Text
SaveSetting "JanApp", "Comment", "ShareFont", Me.ComboBoxFont.Text
SaveSetting "JanApp", "Comment", "ShareFontSize", Me.ComboBoxSize.Text
End Sub
lo7Tt0Wx.rar
(27.74 KB, 下载次数: 56)
|