Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default Formatting a comment by code

How can I apply bold formatting to the date part of the following code?
Target.Offset(0, 2).AddComment UserName() & " - AoS due by: " &
Format(strTemp, "dd/mm/yy")
--
Traa Dy Liooar

Jock
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Formatting a comment by code

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim strTemp As Date

If Target.Cells.Count 1 Then
Exit Sub
End If

If Intersect(Target, Me.Range("A:A")) Is Nothing Then
Exit Sub
End If

strTemp = Date

With Target.Offset(0, 2)
If .Comment Is Nothing Then
'do nothing
Else
.Comment.Delete
End If

.AddComment Application.UserName & " - AoS due by: " _
& Format(strTemp, "dd/mm/yy")

.Comment.Shape.TextFrame _
.Characters(Len(.Comment.Text) - 7, 8).Font.Bold = True

End With

End Sub
Jock wrote:

How can I apply bold formatting to the date part of the following code?
Target.Offset(0, 2).AddComment UserName() & " - AoS due by: " &
Format(strTemp, "dd/mm/yy")
--
Traa Dy Liooar

Jock


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default Formatting a comment by code

Hi Dave,
Thanks for your code.
As the snippet of code I placed in my thread is only a very small part of a
bigger picture, I can't replace mine with your example.
I have tried to add the line
..Comment.Shape.TextFame.... in various guises to my code however nothing
goes bold in the comment.
Thanks for trying though.
--
Traa Dy Liooar

Jock


"Dave Peterson" wrote:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim strTemp As Date

If Target.Cells.Count 1 Then
Exit Sub
End If

If Intersect(Target, Me.Range("A:A")) Is Nothing Then
Exit Sub
End If

strTemp = Date

With Target.Offset(0, 2)
If .Comment Is Nothing Then
'do nothing
Else
.Comment.Delete
End If

.AddComment Application.UserName & " - AoS due by: " _
& Format(strTemp, "dd/mm/yy")

.Comment.Shape.TextFrame _
.Characters(Len(.Comment.Text) - 7, 8).Font.Bold = True

End With

End Sub
Jock wrote:

How can I apply bold formatting to the date part of the following code?
Target.Offset(0, 2).AddComment UserName() & " - AoS due by: " &
Format(strTemp, "dd/mm/yy")
--
Traa Dy Liooar

Jock


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Formatting a comment by code

all you needed to do was add a line

below this:
Target.Offset(0, 2).AddComment UserName() & " - AoS due by: " &
Format(strTemp, "dd/mm/yy")
add Dave Peterson's code:
target.Offset(0, 2).Comment.Shape.TextFrame _
.Characters(Len(target.Offset(0, 2).Comment.Text) - 7,
8).Font.Bold = True


"Jock" wrote in message
...
Hi Dave,
Thanks for your code.
As the snippet of code I placed in my thread is only a very small part of
a
bigger picture, I can't replace mine with your example.
I have tried to add the line
.Comment.Shape.TextFame.... in various guises to my code however nothing
goes bold in the comment.
Thanks for trying though.
--
Traa Dy Liooar

Jock


"Dave Peterson" wrote:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim strTemp As Date

If Target.Cells.Count 1 Then
Exit Sub
End If

If Intersect(Target, Me.Range("A:A")) Is Nothing Then
Exit Sub
End If

strTemp = Date

With Target.Offset(0, 2)
If .Comment Is Nothing Then
'do nothing
Else
.Comment.Delete
End If

.AddComment Application.UserName & " - AoS due by: " _
& Format(strTemp, "dd/mm/yy")

.Comment.Shape.TextFrame _
.Characters(Len(.Comment.Text) - 7, 8).Font.Bold = True

End With

End Sub
Jock wrote:

How can I apply bold formatting to the date part of the following code?
Target.Offset(0, 2).AddComment UserName() & " - AoS due by: " &
Format(strTemp, "dd/mm/yy")
--
Traa Dy Liooar

Jock


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default Formatting a comment by code

Thanks to Patrick and Dave
--
Traa Dy Liooar

Jock


"Patrick Molloy" wrote:

all you needed to do was add a line

below this:
Target.Offset(0, 2).AddComment UserName() & " - AoS due by: " &
Format(strTemp, "dd/mm/yy")
add Dave Peterson's code:
target.Offset(0, 2).Comment.Shape.TextFrame _
.Characters(Len(target.Offset(0, 2).Comment.Text) - 7,
8).Font.Bold = True


"Jock" wrote in message
...
Hi Dave,
Thanks for your code.
As the snippet of code I placed in my thread is only a very small part of
a
bigger picture, I can't replace mine with your example.
I have tried to add the line
.Comment.Shape.TextFame.... in various guises to my code however nothing
goes bold in the comment.
Thanks for trying though.
--
Traa Dy Liooar

Jock


"Dave Peterson" wrote:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim strTemp As Date

If Target.Cells.Count 1 Then
Exit Sub
End If

If Intersect(Target, Me.Range("A:A")) Is Nothing Then
Exit Sub
End If

strTemp = Date

With Target.Offset(0, 2)
If .Comment Is Nothing Then
'do nothing
Else
.Comment.Delete
End If

.AddComment Application.UserName & " - AoS due by: " _
& Format(strTemp, "dd/mm/yy")

.Comment.Shape.TextFrame _
.Characters(Len(.Comment.Text) - 7, 8).Font.Bold = True

End With

End Sub
Jock wrote:

How can I apply bold formatting to the date part of the following code?
Target.Offset(0, 2).AddComment UserName() & " - AoS due by: " &
Format(strTemp, "dd/mm/yy")
--
Traa Dy Liooar

Jock

--

Dave Peterson




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Formatting a comment by code

"Traa Dy Liooar " ??

:)

"Jock" wrote in message
...
Thanks to Patrick and Dave
--
Traa Dy Liooar

Jock


"Patrick Molloy" wrote:

all you needed to do was add a line

below this:
Target.Offset(0, 2).AddComment UserName() & " - AoS due by: " &
Format(strTemp, "dd/mm/yy")
add Dave Peterson's code:
target.Offset(0, 2).Comment.Shape.TextFrame _
.Characters(Len(target.Offset(0, 2).Comment.Text) - 7,
8).Font.Bold = True


"Jock" wrote in message
...
Hi Dave,
Thanks for your code.
As the snippet of code I placed in my thread is only a very small part
of
a
bigger picture, I can't replace mine with your example.
I have tried to add the line
.Comment.Shape.TextFame.... in various guises to my code however
nothing
goes bold in the comment.
Thanks for trying though.
--
Traa Dy Liooar

Jock


"Dave Peterson" wrote:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim strTemp As Date

If Target.Cells.Count 1 Then
Exit Sub
End If

If Intersect(Target, Me.Range("A:A")) Is Nothing Then
Exit Sub
End If

strTemp = Date

With Target.Offset(0, 2)
If .Comment Is Nothing Then
'do nothing
Else
.Comment.Delete
End If

.AddComment Application.UserName & " - AoS due by: " _
& Format(strTemp, "dd/mm/yy")

.Comment.Shape.TextFrame _
.Characters(Len(.Comment.Text) - 7, 8).Font.Bold = True

End With

End Sub
Jock wrote:

How can I apply bold formatting to the date part of the following
code?
Target.Offset(0, 2).AddComment UserName() & " - AoS due by: " &
Format(strTemp, "dd/mm/yy")
--
Traa Dy Liooar

Jock

--

Dave Peterson


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting a comment using code Jock Excel Programming 3 May 11th 09 03:08 PM
Excel comment formatting mleinok Excel Discussion (Misc queries) 3 June 27th 07 07:40 PM
Preserving Comment Box Formatting KC VBA Qns Excel Programming 3 August 24th 06 12:09 PM
Code to add comment box chris46521[_9_] Excel Programming 2 July 28th 06 03:22 PM
Formatting certain text within a comment pikapika13[_15_] Excel Programming 1 July 13th 06 03:45 PM


All times are GMT +1. The time now is 09:41 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"