More elaboration on help pages

P

paul.domaskis

I just reviewed the example in the Help for ReplaceFormat. Then I
went to the Help for Replace method as applied to a Range object.
From that description, I would never have guessed that providing empty
strings for the What and Replacement "variants" would yield the effect
implied by the ReplaceFormat example. For example, I thought that the
ReplaceFormat would only affect replacement text.

Are there more comprehensive help pages (possibly on the web) on these
classes that elaborate on the terse descriptions in the Help? As a
newbie to VBA, and from experience in other environments, I intend to
rely quite a bit on accurate, comprehensive, and well organized
documentation to figure out how to code. VBA's help seems well
organized, but actual descriptive text seems quite terse and
incomplete. Is there some kind of definitive standard that one could
resort to in order to suss out the subtleties of meaning (which often
aren't very subtle in their coding implications)?

Thanks.
 
P

Patrick Molloy

the Help looks perfectly fine to me -- i see no empty strings. Can you
clarify your problem please?

from Help:

Sets the replacement criteria to use in replacing cell formats.

expression.ReplaceFormat

expression Required. An expression that returns one of the objects in the
Applies To list.

Example
The following example sets the search criteria to find cells containing
Arial, Regular, Size 10 font, replaces their formats with Arial, Bold, Size 8
font, and then notifies the user.

Sub MakeBold()

' Establish search criteria.
With Application.FindFormat.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
End With

' Establish replacement criteria.
With Application.ReplaceFormat.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
End With

' Notify user.
With Application.ReplaceFormat.Font
MsgBox .Name & "-" & .FontStyle & "-" & .Size & _
" font is what the search criteria will replace cell formats
with."
End With

End Sub
 
J

JLGWhiz

The Replace Method is for replacing cell values and strings. The
ReplaceFormat method is for just that, replacing formats. VBA is an object
oriented langauge. The objects are modified by their properties.
John Walkenbach has a good book for beginners, available through Amazon.Com,
titled Excel VBA Programming for Dummies which sells at a reasonable price.
It explains a lot of these type issues in detail.
 
P

paul.domaskis

The actual code in question follows the code that you pasted...here is
the remainder of the example:

' Make the replacements in the worksheet.
Cells.Replace What:="", Replacement:="", _
SearchFormat:=True, ReplaceFormat:=True

Again, this was provided just as an example. I was wondering if there
were help pages online that elaborate more (in general).

Thanks.
 
P

paul.domaskis

I'm relatively comfortable with OOP, though in C++/STL/matlab. The
example to which I'm referring is in ReplaceFormat help page, but
makes use of Replace. It's the example implies things about how
Replace works with null strings in What and Replacement which is not
apparent from the Replace help page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top