Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-04-2012, 10:36 AM
Sorcerer13 Sorcerer13 is offline Set paragraph text to bold. Windows Vista Set paragraph text to bold. Office 2010 32bit
Novice
Set paragraph text to bold.
 
Join Date: Sep 2012
Location: God's Own County
Posts: 16
Sorcerer13 is on a distinguished road
Default Set paragraph text to bold.

Hi!
Sorry if this is an "amateur" question: i've used VBA in Excel fairly extensively, but not much in Word.
Im using MSOffice 2010.
I have a template document with (working) code in it, which asks the User for various details. These details are processed and stored in a dynamic array, until the User indicates that the "data gathering" has completed.
At this point I want to write the array to the end of the document, with each element of the array being a "sentence". This bit is working.
Extracts from the code are shown below

Code:
 
Dim intMax                  As Integer
Dim intPtr                  As Integer
Dim strDate                 As String
Dim strCategory             As String
Dim strHdr                  As String
Dim strOldCategory          As String
Dim strText                 As String
 
 
  strOldCategory = ""
 
 
  With ActiveDocument.Content
    .InsertAfter vbCrLf
    intMax = UBound(gvarTexts)
'*
'** Add texts, with formatting if appropriate.
'*
    For intPtr = 0 To intMax
      strCategory = Left(gvarTexts(intPtr), 20)
      strDate = Mid(gvarTexts(intPtr), 22, 10)
      strText = Mid(gvarTexts(intPtr), 33)
      If strCategory <> strOldCategory Then
        strOldCategory = strCategory
        strHdr = strCategory & ":" & strDate
        .InsertAfter vbCrLf & strHdr & vbCrLf
'*
'** Here something magic needs to happen to change strHdr
'** which has just been written to be Bold and Underlined!
'*
      End If
      .InsertAfter strText & vbCrLf
    Next intPtr
In essence, the first part of each array string is a "Category". When the Category changes I want to write the new Category in Bold and Underlined, then continue writing the texts which match that Category in the normal way (i.e. not bold or underlined).


I think it needs to happen around the area marked "Here something magic" etc.
Can any kind soul point me in the right direction?
Reply With Quote
 

Tags
bold, font, underline



Similar Threads
Thread Thread Starter Forum Replies Last Post
Set paragraph text to bold. How to I make text Bold in a User Form -Visual Basic gurp99 Word VBA 11 03-12-2012 04:05 PM
Set paragraph text to bold. Animate text to bold then animate text to regular? seanspotatobusiness PowerPoint 2 01-13-2011 12:08 PM
Set paragraph text to bold. exporting bold text from excel to word? stella@happisburgh.net Excel 3 12-05-2010 08:03 AM
Set paragraph text to bold. Can't print bold or italic text cornettd PowerPoint 1 05-10-2010 10:07 AM
Problem with Bold text in the headers gail Word 0 04-13-2010 02:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:30 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft