+ Reply to Thread
Results 1 to 2 of 2

VBA to make text Bold

  1. #1
    Registered User
    Join Date
    04-14-2020
    Location
    pune
    MS-Off Ver
    2016
    Posts
    1

    VBA to make text Bold

    Shiva98189
    Beginner
    A moment ago


    Friends I Have created the following VBA code to fill the word document at particular Bookmark now I want to Bold and underline the inserted word

    # Option Explicit

    Const FilePath As String = "C:\Users\91897\Desktop\VBA\AgriDocument\print\"
    Sub CreateagriDocument()
    Dim ws As Worksheet
    Dim wrdrange As Range


    Set ws = ThisWorkbook.Sheets("Sheet1")
    Dim objWord As Object

    Set objWord = CreateObject("Word.Application")

    objWord.Visible = True
    objWord.Documents.Open ("C:\Users\91897\Desktop\VBA\AgriDocument\DOC_TEMPLATE\SD21IMCLR.doc")
    With objWord.ActiveDocument
    .Bookmarks("cus1name").Range.Text = ws.Range("B4").Value
    .Bookmarks("Place").Range.Text = ws.Range("B14").Value
    .Bookmarks("date").Range.Text = ws.Range("B11").Value
    .Bookmarks("rsfig").Range.Text = ws.Range("B12").Value
    .Bookmarks("rsword").Range.Text = ws.Range("B13").Value
    .Bookmarks("percentoverbr").Range.Text = ws.Range("B17").Value








    .SaveAs2 FilePath & ws.Range("B4").Value & "SD21IMCLR" & ".doc"

    objWord.Quit
    Set objWord = Nothing
    MsgBox "FILLED DOCUMENTS CREATED IN FOLDER 'AUTO_DOCUMENTATION' IN D: DRIVE!"

    End With

    End Sub


    Kindly Help

    Thanking You
    Attached Files Attached Files
    Last edited by shivshanakar; 04-14-2020 at 12:45 PM. Reason: edit

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: VBA to make text Bold

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I did it for you this time. Please read forum rules. Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] When clicking cell within range, make it bold. If already bold, make it not bold
    By jokris in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-08-2016, 07:12 PM
  2. Asterisks surrounding text make it bold
    By XOR LX in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 05-23-2013, 08:21 AM
  3. [SOLVED] How to make part of the text in a cell bold
    By aymanzone in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-14-2012, 05:26 AM
  4. How to make some text in a Cell Bold?
    By v2jtb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-29-2012, 11:00 AM
  5. Make text partly bold, but failed
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-10-2010, 09:05 AM
  6. make text dependant on cell - Bold
    By stevecontracts in forum Excel General
    Replies: 3
    Last Post: 02-18-2010, 04:50 AM
  7. Need to make certain text bold in a comment using vba
    By Bravurian17 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2009, 11:58 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1