Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Properties returning object reference or value?

In the Help for Font Object, there is this example code:

Worksheets("Sheet1").Range("A1:C5").Font.Bold = True

The help also says that the Font property returns a Font object.
Assuming that the property returns a value rather than a reference,
I'm imagining an actual construct that exists apart from the range
itself, containing fields that describe the font(s) used within the
range. I'm trying to understand how assigning a True to one of the
member fields in the Font object (the Bold field) causes True to be
propagated back to the actual range cells. In C++ vernacular, has the
assignment operator "=" been overriden?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Properties returning object reference or value?

Bold is a property of the Font object. The Boolean value of Bold is either
True or False. It has nothing to do with the Range Object.



wrote in message
...
In the Help for Font Object, there is this example code:

Worksheets("Sheet1").Range("A1:C5").Font.Bold = True

The help also says that the Font property returns a Font object.
Assuming that the property returns a value rather than a reference,
I'm imagining an actual construct that exists apart from the range
itself, containing fields that describe the font(s) used within the
range. I'm trying to understand how assigning a True to one of the
member fields in the Font object (the Bold field) causes True to be
propagated back to the actual range cells. In C++ vernacular, has the
assignment operator "=" been overriden?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Properties returning object reference or value?

Function emboldened(target As Range) As Boolean
Application.Volatile
On Error Resume Next
emboldened = target.Font.Bold '= True
If Err.Number < 0 Then
emboldened = False
End If
On Error GoTo 0
End Function

this UDF actually returns TRUE if all the cells in the selected Range have
their FONT Emboldened set to TRUE
The error trap is required since a #Value is returned if some but not all
cells in the passed range have this.




wrote in message
...
In the Help for Font Object, there is this example code:

Worksheets("Sheet1").Range("A1:C5").Font.Bold = True

The help also says that the Font property returns a Font object.
Assuming that the property returns a value rather than a reference,
I'm imagining an actual construct that exists apart from the range
itself, containing fields that describe the font(s) used within the
range. I'm trying to understand how assigning a True to one of the
member fields in the Font object (the Bold field) causes True to be
propagated back to the actual range cells. In C++ vernacular, has the
assignment operator "=" been overriden?

Thanks


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
Returning Access Table properties to Excel James[_3_] Excel Programming 3 May 28th 07 02:42 PM
Returning Access Table properties to Excel James[_3_] New Users to Excel 2 May 28th 07 01:13 PM
returning pivottable object from a range object Grant Excel Programming 2 September 27th 04 02:22 AM
Workbooks.Open(filename) : Returning err: Object reference not... (in VB.NET) bryan Excel Programming 2 January 20th 04 07:42 PM
iterating through all properties of an object Barney Fife Excel Programming 4 August 22nd 03 03:18 AM


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