Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Need help with Macro to format comments

Discussion in 'Information Technology' started by zulfer7, Jul 28, 2006.

  1. zulfer7

    zulfer7
    Expand Collapse
    Guest

    Can you help me by editing this code so that every instance of the username
    is in bold whether it is a new comment or an add to comment? I would prefer
    just the username be in bold but the username,hour,time line being all bold
    as it is now is acceptable.

    Sub KeyCellsChanged()
    Dim strDate As String
    Dim cmt As Comment
    Dim Username As String
    Dim lName As Long

    strDate = "ddmmmyy hh:mm"
    Username = Application.Username
    Set cmt = ActiveCell.Comment
    lName = 0

    If cmt Is Nothing Then
    Set cmt = ActiveCell.AddComment
    cmt.Text Text:=Username & " " & Format(Now, strDate) & Chr(10)
    lName = InStr(1, cmt.Text, Chr(10)) - 1
    cmt.Shape.TextFrame.Characters(1, lName).Font.Bold = True
    Else
    cmt.Text Text:=cmt.Text & Chr(10) _
    & Username & Format(Now, strDate)
    lName = InStr(1, cmt.Text, Chr(10)) - 1
    cmt.Shape.TextFrame.Characters.Font.Bold = False
    cmt.Shape.TextFrame.Characters(1, lName).Font.Bold = True
    End If

    End Sub
     
  2. Loading...

    Similar Threads Forum Date
    Interracial And Interfaith Marriage, Help Needed To Confront/convince My Parents Love & Marriage Aug 16, 2016
    17 yr old Baljit needs your help Get Involved Aug 19, 2015
    Learn Punjabi Need help Language, Arts & Culture May 20, 2014
    United Sikhs From United Sikhs. Phillippines Needs Your Help Sikh Organisations Nov 22, 2013
    Need Help... (Keeping Hair) Questions and Answers Sep 2, 2013

  3. John Vinson

    John Vinson
    Expand Collapse
    Guest

    On Wed, 17 May 2006 07:51:02 -0700, zulfer7
    <zulfer7@discussions.microsoft.com> wrote:

    >Can you help me by editing this code so that every instance of the username
    >is in bold whether it is a new comment or an add to comment? I would prefer
    >just the username be in bold but the username,hour,time line being all bold
    >as it is now is acceptable.


    This appears to be code for an Excel spreadsheet - right?

    If so you'll have better luck posting your question in an Excel coding
    newsgroup. This newsgroup is for a different program, Microsoft
    Access. Please scroll down the list of subjects on the left of the
    screen and repost in a suitable Excel group.

    John W. Vinson[MVP]
     

Share This Page