1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help With Passing Bold Formatting Through String Into Word

Discussion in 'Visual Basic ( VB )' started by IcePirates, Jan 28, 2009.

  1. IcePirates

    IcePirates New Member

    Joined:
    Jan 28, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hello,

    My question is VBA/Excel related...

    I have an excel sheet, in that excel sheet is a command button, once clicked the command button creates a Word document.

    Im trying to get my VBA script to bold certain text that will be in the word document. But all my attempts to bold certain cell contents have failed.
    Im not getting any errors from the editor, its just not bolding certain text Ive told it too when the word document gets created.

    I have included an attachment (And Ive tried the following methods already)

    1. ActiveCell.Font.Bold & "This Is Function One, This Text Will Appear Bold" & wks.Cells(ActiveCell.Row, 2) & _

    2. "This is Function Two, This Text Will Appear Bold" & wks.Cells(ActiveCell.Row, 2).Font.Bold

    3. "This is Function Three, This Text Will Appear Bold" & wks.Cells(ActiveCell.Row, 2) & (ActiveCell.Font.Bold) & _
     
    Last edited by a moderator: Jan 28, 2009
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Please try explaining in post rather than attaching the complete problem.
     
  3. IcePirates

    IcePirates New Member

    Joined:
    Jan 28, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    The issue arrises, when a user clicks on the command button inside the .xls to create the word document...Whats happening is, Im trying to tell certain lines to bold when the word document gets created, such as: (in the Excel sheet, Module 1, you will find)

    "Sale File #: " & wks.Cells(ActiveCell.Row, 9) & vbNewLine & _

    I change that to something like
    "Sale File #: " & wks.Cells(ActiveCell.Row, 9) & (ActiveCell.Row.Font.Bold) & vbNewLine & _


    Thereby when the macro is excuted inside the .xls sheet it should make the text "Sale File #" bold in the word document...

    However - Im not getting any errors when changing the VBA, the problem arrises when the Word Document gets created, because the particular text I want bold, is not bolding in the word document...

    Does that make a bit more sense?
    Let me know if it doesn't, I can explain some more.
     

Share This Page