Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

Problems changing font size

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TT - 26 Jan 2005 18:12 GMT
Hello,

I'm trying to copy cells from Excel to Word. This in itself works just fine.
But, I'm having problems in changing font size in different paragraphs. The
settings I apply to the first paragraph apply to all - no matter what.

Here's the code:

------------
Sub TW()

Dim AppWD As Word.Application
Dim DocWD As Word.Document
Dim RangeWD As Word.Range

Set AppWD = CreateObject("Word.Application.11")
AppWD.Visible = True

Set DocWD = AppWD.Documents.Add
With DocWD
   Set RangeWD = .Range
   Sheets("T").Select
   Range("A1:F1").Select
   Selection.Copy
   With RangeWD
       .Font.Name = "Arial"
       .Font.Size = 12
       .Font.Bold = True
       .PasteSpecial DataType:=wdPasteText
       'DataType:=wdPasteText, Placement:=wdInLine
   End With
   Sheets("T").Select
   Range("A2:A6").Select
   Selection.Copy
   With RangeWD
       .Font.Name = "Arial"
       .Font.Size = 12
       .Font.Bold = False
       .PasteSpecial DataType:=wdPasteText
   End With
End With

End Sub
----------------------

The problem is that font.name, font.size, font.bold I've given to range
A1:F1 applies to A2:A6 as well. How can I get this done? Any ideas?

TIA,

TT
Ol - 27 Jan 2005 21:55 GMT
> Hello,
>
[quoted text clipped - 47 lines]
>
> TT

...
Try to modify that code:

...
    With RangeWD
        .Font.Name = "Arial"
        .Font.Size = 12
        .Font.Bold = False
        .PasteSpecial DataType:=wdPasteText
    End With
End With

to

...
    With RangeWD
        .Collapse Direction:=wdCollapseEnd
        .Font.Name = "Arial"
        .Font.Size = 12
        .Font.Bold = False
        .PasteSpecial DataType:=wdPasteText
    End With

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.