Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Edit Comment from UserForm

Not sure. If you comment that line does the rest work OK.

In theory that code should format the first comment line bold.

Does it error in all cases, try applying with different text and lines
(don't forget need to press Ctrl-Enter to force a new line in the textbox

Replace that line with the following

On error resume next
mCom.Shape.TextFrame.Characters(1, pos - 1).Font.Bold = True

If err.number then
msgbox err.description,,pos
err.clear
end if
on error goto 0

What's the error description, also what's the text and 'pos'

Which Excel version ?

Regards,
Peter T


"Joe_Hunt via OfficeKB.com" <u45578@uwe wrote in message
news:8a48758a7579e@uwe...
Thank you Peter. I ran into a problem though. When I tried to run this
code I
got a syntax error on this line:

mCom.Shape.TextFrame.Characters(1, pos - 1).Font.Bold = True

Any thoughts?

Peter T wrote:
Try the following for ideas.
With the curser in the textbox press F12 to 'get' next comment text and
Ctrl-F12 to 'set' comment text.

Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
Dim s As String, sUN As String
Static n As Long

' press F12 to write next comment to textbox
' press Ctrl-F12 to write textbox text to comment

If KeyCode = vbKeyF12 Then
If Shift = 2 Then
If Not mCom Is Nothing Then
sUN = Application.UserName & ":"
s = Replace(TextBox1.Text, vbCrLf, vbLf)
If Left(s, Len(sUN)) < sUN Then
s = sUN & vbLf & s
End If

mCom.Text Text:=s

mCom.Shape.TextFrame.Characters.Font.Bold = False
pos = InStr(2, s, vbLf)
If pos Then
mCom.Shape.TextFrame.Characters(1, pos - 1).Font.Bold
=
True
End If
End If

Else
cnt = ActiveSheet.Comments.Count
If cnt Then
n = n + 1
If n cnt Then n = 1
Set mCom = ActiveSheet.Comments(n)
TextBox1.Text = mCom.Text
Me.Caption = "Comment in cell " & mCom.Parent.Address(0,
0)
End If
End If
End If
End Sub

Up to you if you want to include the stuff about Username and first line
bold.

Regards,
Peter T

Hello all, and thank you for all the help you've given me, even though
most

[quoted text clipped - 22 lines]
appreciate
any help you can give me.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200809/1



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
Comment Edit Outook Calendar Problem Excel Worksheet Functions 1 February 25th 10 02:34 PM
VBA to edit a comment Brent E Excel Discussion (Misc queries) 3 November 6th 07 12:15 AM
How can I edit a comment w/o first having to select Show Comment Mary Ann Excel Discussion (Misc queries) 1 August 26th 05 12:34 AM
cannot edit comment deo89 Excel Discussion (Misc queries) 4 August 24th 05 05:20 PM
Edit Comment Box Eager2Learn[_14_] Excel Programming 1 June 25th 04 01:56 AM


All times are GMT +1. The time now is 10:31 PM.

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

About Us

"It's about Microsoft Excel"