Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.formatting.longdocs
Lucy in the sky
 
Posts: n/a
Default Apply font attributes to a selection/range

Working with Word 2003.

I have a table formatting function to apply font format from a table cell to
another table.

While code fragment #1 works fine, I would expect code fragment #2 behaves
the same. However, it is not. I have to modify it to code fragment #3 to make
it work as I expected.

Private Sub FormatTable()
Dim objSourceTable As Word.Table
Dim objTargetTable As Word.Table
Dim objSourceFont As Word.Font

Set objSourceTable = get a reference to table A in active document
Set objTargetTable = get a reference to table B in active document

Set objSourceFont = objSourceTable.Cell(1, 1).Range.Font.Duplicate

' #1 - OK, font attributes applied correctly
objTargetTable.Cell(2, 2).Font = objSourceFont

' #2 - Not OK
objTargetTable.Columns(1).Select
objTargetTable.Application.Selection.Font = objSourceFont

' #3 - OK
objTargetTable.Columns(1).Select
objTargetTable.Application.Selection.Font.Bold = objSourceFont.Bold
apply other attribute one by one
...........
End Sub

Therefore I would like to verify why #2 is not working? What is the proper
way to apply font attributes? Looks like #1 is faster?
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I apply a different font to a cross reference? KellyDW Microsoft Word Help 10 April 7th 06 09:27 PM
Why won't word allow me to apply different font? Evergreen Microsoft Word Help 1 August 16th 05 11:16 AM
Default font - possible bulletproof fix in Word 2003 [email protected] Microsoft Word Help 0 January 14th 05 10:14 PM
How do I ensure that the font attributes do not affect all of tex. Mtess45 Microsoft Word Help 1 January 14th 05 07:44 PM
Can't apply Arabic Font ? Nabil Bouitieh Microsoft Word Help 0 December 15th 04 01:01 AM


All times are GMT +1. The time now is 11:11 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"