Microsoft Office Tutorials and References
In Depth Information
19.4.3.4 Weight property
19.4.3.4 Weight property
The Weight property returns or sets the weight of the border. It can be one of the following
XlBorderWeight constants:
Enum XlBorderWeight
xlMedium = -4138
xlHairline = 1
xlThin = 2
xlThick = 4
End Enum
19.4.4 The Characters Object
The Characters object represents a contiguous sequence of text characters. The main purpose of
the Characters object is to modify a portion of a text string. The syntax is:
RangeObject .Characters( start , length )
where start is the start character number and length is the number of characters. To illustrate,
the following code boldfaces the first word in a cell:
Dim rng As Range
Set rng = Range("A1")
rng.Characters(1, InStr(rng.Value, " ") - 1).Font.Bold = True
The result is shown in Figure 19-23 .
Figure 19-23. Boldfacing the first word of a cell
19.4.5 The Comment Object
Recall that the AddComment method of the Range object is used to add a comment to a range.
Once the comment has been added, a corresponding Comment object is created. Each comment
object belongs to the Comments collection of the Worksheet object.
To illustrate, the following code creates a comment in cell A1 if it does not already exist. It then
sets the text and makes the comment visible for approximately three seconds. Note the use of the
DoEvents statement to ensure that Windows has the opportunity to display the comment before
entering the Do loop. (You might want to try this code without the DoEvents statement. On my
system, the comment is not displayed.) Note also that the Timer function returns the number of
seconds since midnight (so there is a potential problem if the three-second interval happens to
occur at midnight).
Dim tm As Single
tm = Timer
If Range("A1").Comment Is Nothing Then
Range("A1").AddComment "comment"
End If
Range("A1").Comment.Text "Created: " & Now
 
 
Search JabSto ::




Custom Search