Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XL2000: How to Change the Font in a Cell Comment


View products that this article applies to.

This article was previously published under Q213680

↑ Back to the top


Symptoms

When you record a macro in which you change the font of a cell comment, and you then subsequently rerun the macro, the font of the comment does not change as you expected.

↑ Back to the top


Cause

Depending on the method you used to select the comment while recording the macro, your recorded macro may not contain the code necessary to modify the font of the cell comment.

↑ Back to the top


Resolution

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners - https://partner.microsoft.com/global/30000104

Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS The following sample macro changes the font of the active cell's comment to Courier, Bold with a size of 14:
Sub Comment_Font_Change()
    With ActiveCell.Comment.Shape.TextFrame.Characters.Font
        .Name = "courier"
        .Size = 14
        .Bold = True
    End With
End Sub
				
You can also change the font of all comments in a worksheet by running the following macro:
Sub All_Comment_Font_Change()
    For Each x In ActiveSheet.Comments
       With x.Shape.TextFrame.Characters.Font
            .Name = "courier"
            .Size = 14
            .Bold = True
        End With
    Next x
End Sub
				

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

Depending on how you select a cell comment, a different version of the Format Comment dialog box appears when you click Comment on the Format menu. If you have the comment frame selected, and the pointer is not within the comment text, the Format Comment dialog box displays seven tabs: Font, Alignment, Colors and Lines, Size, Protection, Properties, and Margins. However, if the pointer is flashing within the comment text, you are in Edit mode, and the Format Comment dialog box will display just one tab: Font.

If you record a macro in which you change the font while in Edit mode, the recorded macro does not produce the necessary code for modifying the comment font. The following code is representative of a macro recorded while changing the comment font in Edit mode:
Sub Macro1()
    Range("A1").Comment.Shape.Select True
    Range("A1").Comment.Text Text:="Username:" & Chr(10) & _
        "this is a test"
    Range("A2").Select
End Sub
				
For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
212240� XL2000: Unable to Rotate AutoShapes While in Edit Mode

↑ Back to the top


References

For more information about the Comment Object, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type comment object in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

For additional information about getting help with Visual Basic forApplications, click the article number below to view the article in the Microsoft Knowledge Base:
163435� VBA: Programming Resources for Visual Basic for Applications

↑ Back to the top


Keywords: KB213680, kbprogramming, kbpending, kbdtacode, kbbug

↑ Back to the top

Article Info
Article ID : 213680
Revision : 8
Created on : 11/23/2006
Published on : 11/23/2006
Exists online : False
Views : 270