#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default NewComment

I have the flllowing code to add a new comment, can anyone help me add a
line so it would add the date on the comment

Sub NewComment2()

Dim strComment As String

strComment = InputBox("EnterNote: ", "Note.")

If Len(Trim(strComment)) = "" Then Exit Sub


With ActiveCell
.ClearComments
.AddComment
.Comment.Visible = False
With .Comment.Shape.TextFrame
.Characters.Text = strComment
.Characters.Font.Name = "Comic Sans MS"
.Characters.Font.Bold = True
.Characters.Font.Italic = False
.Characters.Font.Size = 11
'or even certain Characters'
.Characters(14, 4).Font.Bold = False
.Characters(1, 3).Font.ColorIndex = 0
.AutoSize = True
End With
End With

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default NewComment

Hi Jeff
change the line
If Len(Trim(strComment)) = "" Then Exit Sub

to
If Len(Trim(strComment)) = "" Then
Exit Sub
else
strComment = "Date: " & Format(Date,"MM/DD/YYYY") & _
vbcr & Trim(strComment)
end if



--
Regards
Frank Kabel
Frankfurt, Germany


Jeff Mackeny wrote:
I have the flllowing code to add a new comment, can anyone help me
add a line so it would add the date on the comment

Sub NewComment2()

Dim strComment As String

strComment = InputBox("EnterNote: ", "Note.")

If Len(Trim(strComment)) = "" Then Exit Sub


With ActiveCell
.ClearComments
.AddComment
.Comment.Visible = False
With .Comment.Shape.TextFrame
.Characters.Text = strComment
.Characters.Font.Name = "Comic Sans MS"
.Characters.Font.Bold = True
.Characters.Font.Italic = False
.Characters.Font.Size = 11
'or even certain Characters'
.Characters(14, 4).Font.Bold = False
.Characters(1, 3).Font.ColorIndex = 0
.AutoSize = True
End With
End With

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default NewComment

Frank,

When running it it says error compling 'Else without IF' , it now looks like
this

Dim strComment As String

strComment = InputBox("EnterNote: ", "Note.")

If Len(Trim(strComment)) = "" Then Exit Sub

Else
strComment = "Date: " & Format(Date, "MM/DD/YYYY") & _
vbCr & Trim(strComment)
End If


With ActiveCell
.ClearComments
.AddComment
.Comment.Visible = False
With .Comment.Shape.TextFrame
.Characters.Text = strComment
.Characters.Font.Name = "Comic Sans MS"
.Characters.Font.Bold = True
.Characters.Font.Italic = False
.Characters.Font.Size = 11
'or even certain Characters'
.Characters(14, 4).Font.Bold = False
.Characters(1, 3).Font.ColorIndex = 0
.AutoSize = True
End With
End With

End Sub

"Frank Kabel" wrote in message
...
Hi Jeff
change the line
If Len(Trim(strComment)) = "" Then Exit Sub

to
If Len(Trim(strComment)) = "" Then
Exit Sub
else
strComment = "Date: " & Format(Date,"MM/DD/YYYY") & _
vbcr & Trim(strComment)
end if



--
Regards
Frank Kabel
Frankfurt, Germany


Jeff Mackeny wrote:
I have the flllowing code to add a new comment, can anyone help me
add a line so it would add the date on the comment

Sub NewComment2()

Dim strComment As String

strComment = InputBox("EnterNote: ", "Note.")

If Len(Trim(strComment)) = "" Then Exit Sub


With ActiveCell
.ClearComments
.AddComment
.Comment.Visible = False
With .Comment.Shape.TextFrame
.Characters.Text = strComment
.Characters.Font.Name = "Comic Sans MS"
.Characters.Font.Bold = True
.Characters.Font.Italic = False
.Characters.Font.Size = 11
'or even certain Characters'
.Characters(14, 4).Font.Bold = False
.Characters(1, 3).Font.ColorIndex = 0
.AutoSize = True
End With
End With

End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default NewComment

never mind it works.

thanks

"Jeff Mackeny" wrote in message
...
Frank,

When running it it says error compling 'Else without IF' , it now looks

like
this

Dim strComment As String

strComment = InputBox("EnterNote: ", "Note.")

If Len(Trim(strComment)) = "" Then Exit Sub

Else
strComment = "Date: " & Format(Date, "MM/DD/YYYY") & _
vbCr & Trim(strComment)
End If


With ActiveCell
.ClearComments
.AddComment
.Comment.Visible = False
With .Comment.Shape.TextFrame
.Characters.Text = strComment
.Characters.Font.Name = "Comic Sans MS"
.Characters.Font.Bold = True
.Characters.Font.Italic = False
.Characters.Font.Size = 11
'or even certain Characters'
.Characters(14, 4).Font.Bold = False
.Characters(1, 3).Font.ColorIndex = 0
.AutoSize = True
End With
End With

End Sub

"Frank Kabel" wrote in message
...
Hi Jeff
change the line
If Len(Trim(strComment)) = "" Then Exit Sub

to
If Len(Trim(strComment)) = "" Then
Exit Sub
else
strComment = "Date: " & Format(Date,"MM/DD/YYYY") & _
vbcr & Trim(strComment)
end if



--
Regards
Frank Kabel
Frankfurt, Germany


Jeff Mackeny wrote:
I have the flllowing code to add a new comment, can anyone help me
add a line so it would add the date on the comment

Sub NewComment2()

Dim strComment As String

strComment = InputBox("EnterNote: ", "Note.")

If Len(Trim(strComment)) = "" Then Exit Sub


With ActiveCell
.ClearComments
.AddComment
.Comment.Visible = False
With .Comment.Shape.TextFrame
.Characters.Text = strComment
.Characters.Font.Name = "Comic Sans MS"
.Characters.Font.Bold = True
.Characters.Font.Italic = False
.Characters.Font.Size = 11
'or even certain Characters'
.Characters(14, 4).Font.Bold = False
.Characters(1, 3).Font.ColorIndex = 0
.AutoSize = True
End With
End With

End Sub





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default NewComment

Hi
put the part
Exit Sub
in a separate line!

--
Regards
Frank Kabel
Frankfurt, Germany


Jeff Mackeny wrote:
Frank,

When running it it says error compling 'Else without IF' , it now
looks like this

Dim strComment As String

strComment = InputBox("EnterNote: ", "Note.")

If Len(Trim(strComment)) = "" Then Exit Sub

Else
strComment = "Date: " & Format(Date, "MM/DD/YYYY") & _
vbCr & Trim(strComment)
End If


With ActiveCell
.ClearComments
.AddComment
.Comment.Visible = False
With .Comment.Shape.TextFrame
.Characters.Text = strComment
.Characters.Font.Name = "Comic Sans MS"
.Characters.Font.Bold = True
.Characters.Font.Italic = False
.Characters.Font.Size = 11
'or even certain Characters'
.Characters(14, 4).Font.Bold = False
.Characters(1, 3).Font.ColorIndex = 0
.AutoSize = True
End With
End With

End Sub

"Frank Kabel" wrote in message
...
Hi Jeff
change the line
If Len(Trim(strComment)) = "" Then Exit Sub

to
If Len(Trim(strComment)) = "" Then
Exit Sub
else
strComment = "Date: " & Format(Date,"MM/DD/YYYY") & _
vbcr & Trim(strComment)
end if



--
Regards
Frank Kabel
Frankfurt, Germany


Jeff Mackeny wrote:
I have the flllowing code to add a new comment, can anyone help me
add a line so it would add the date on the comment

Sub NewComment2()

Dim strComment As String

strComment = InputBox("EnterNote: ", "Note.")

If Len(Trim(strComment)) = "" Then Exit Sub


With ActiveCell
.ClearComments
.AddComment
.Comment.Visible = False
With .Comment.Shape.TextFrame
.Characters.Text = strComment
.Characters.Font.Name = "Comic Sans MS"
.Characters.Font.Bold = True
.Characters.Font.Italic = False
.Characters.Font.Size = 11
'or even certain Characters'
.Characters(14, 4).Font.Bold = False
.Characters(1, 3).Font.ColorIndex = 0
.AutoSize = True
End With
End With

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"