[AccessD] OLE Word Doc Font

Jack and Pat drawbridgej at sympatico.ca
Fri Apr 11 16:22:07 CDT 2008


Mark,

Haven't done any programming with Word. But I did a lookup on Word Object
Model and found

http://msdn2.microsoft.com/en-us/library/aa195382(office.10).aspx

and there is a reference to  Property Highlight


.Highlight

I'm looking at the Microsoft Word Visual basic reference.

Here's some sample stuff in the area:
------------------------------------------------------------------ from M$
stuff -----------------
Highlight Property

Find object: True if highlight formatting is included in the find criteria.
Can return or be set to True, False, or wdUndefined. Read/write Long.

Note   The wdUndefined value can be used with the Find object to ignore the
state of highlight formatting in the selection or range that is searched.

Replacement object: True if highlight formatting is applied to the
replacement text. Can return or be set to True, False, or wdUndefined.
Read/write Long.
Example

This example finds all instances of highlighted text in the active document
and removes the highlight formatting by setting the Highlight property of
the Replacement object to False.

Dim rngTemp As Range

Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)
With rngTemp.Find
    .ClearFormatting
    .Highlight = True
    With .Replacement
        .ClearFormatting
        .Highlight = False
    End With
    .Execute Replace:=wdReplaceAll, Forward:=True, FindText:="", _
         ReplaceWith:="", Format:=True
End With

This example applies highlight formatting to the next instance of bold text
in the active document.

With Selection.Find
    .ClearFormatting
    .Font.Bold = True
    With .Replacement
        .ClearFormatting
        .Highlight = True
    End With
    .Execute Forward:=True, FindText:="", ReplaceWith:="", _
        Format:=True
End With
----------------------------------------------------------------------------
----------------------
Jack


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte
Sent: Friday, April 11, 2008 4:04 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] OLE Word Doc Font


Hello All,

I am working with OLE MSWord Object on an access form.  I'm trying to play
with the font...'highlighting' specifically. I can change the
size,color,bold...and stuff but looking for highlighting.

There does not seem to be intellisense for these properties on my maching.

Any thoughts?

Thanks,

Mark A. Matte

Here is the type of code I'm using:

*******************
   oDocument.Content.Select
   With oDocument.Application.Selection
    
   ' Add a heading at the top of the document...
      .Style = oDocument.Styles("Heading 1")
      .Font.Color = &HFF0000
      .TypeText T1
      .ParagraphFormat.Alignment = 1 '[wdAlignParagraphCenter]
      .TypeParagraph
      .TypeParagraph
      .Font.Bold = True
      .TypeText T2

   End With
   Set oDocument = Nothing
********************


_________________________________________________________________
Pack up or back up-use SkyDrive to transfer files or keep extra copies.
Learn how.
hthttp://www.windowslive.com/skydrive/overview.html?ocid=TXT_TAGLM_WL_Refres
h_skydrive_packup_042008
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list