Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-27-2012, 07:09 AM
janith janith is offline Making Line Bold Windows XP Making Line Bold Office 2003
Novice
Making Line Bold
 
Join Date: Apr 2012
Posts: 6
janith is on a distinguished road
Default Making Line Bold

Hi

Hope someone can help me with this. I'm looking for a macro code which will achieve this

I've 600 lines of sentences in word which has a same format i.e:

050612 EXT DKJFSDKFJSLK 21.00 FOR 21 PTS

080612 EXT OIRTYIOJBHFB 19.00 FOR 19 PTS

120612 V&V FGHFHFGHFGH 118.00 FOR 118 PTS

160612 EXT RFGJHFJMHBM 168.00 FOR 168 PTS

240612 V&V FTHFHHFGNH 365.00 FOR 18 PTS

so on running into close to 600 lines.....

What I want the macro to do is ask for a value to be inputed eg: "EXT" and it should search for "EXT" in each line and make the entire line bold in one go.



some thing like this

050612 EXT DKJFSDKFJSLK 21.00 FOR 21 PTS

080612 EXT OIRTYIOJBHFB 19.00 FOR 19 PTS

120612 V&V FGHFHFGHFGH 118.00 FOR 118 PTS

160612 EXT RFGJHFJMHBM 168.00 FOR 168 PTS

240612 V&V FTHFHHFGNH 365.00 FOR 18 PTS

thanks for your support...
Reply With Quote
  #2  
Old 05-29-2012, 06:38 AM
macropod's Avatar
macropod macropod is offline Making Line Bold Windows 7 64bit Making Line Bold Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Janith,

You can do this with a wildcard Find/Replace, where:
Find = [!^13]@String*[^13]
Replace = ^&
and 'String' is the string to match with.

Here's a macro that does the same thing:
Code:
Sub MakeBold()
Application.ScreenUpdating = False
Dim StrFnd As String
StrFnd = InputBox("Please input the text for the lines to make bold", "Make Lines Bold")
If Trim(StrFnd) = "" Then Exit Sub
With ActiveDocument.Range.Find
  .ClearFormatting
  .Text = "[!^13]@" & StrFnd & "*[^13]"
  .Replacement.ClearFormatting
  .Replacement.Font.Bold = True
  .Replacement.Text = "^&"
  .Forward = True
  .Wrap = wdFindContinue
  .Format = True
  .MatchWildcards = True
  .Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-29-2012, 09:43 AM
janith janith is offline Making Line Bold Windows XP Making Line Bold Office 2003
Novice
Making Line Bold
 
Join Date: Apr 2012
Posts: 6
janith is on a distinguished road
Default

well

thank for the code but when i enter "EXT" in the input box everthing turns bold

like this:
050612 EXT DKJFSDKFJSLK 21.00 FOR 21 PTS

080612 EXT OIRTYIOJBHFB 19.00 FOR 19 PTS

120612 V&V FGHFHFGHFGH 118.00 FOR 118 PTS

160612 EXT RFGJHFJMHBM 168.00 FOR 168 PTS

240612 V&V FTHFHHFGNH 365.00 FOR 18 PTS


080612 EXT OIRTYIOJBHFB 19.00 FOR 19 PTS

120612 V&V FGHFHFGHFGH 118.00 FOR 118 PTS
Reply With Quote
  #4  
Old 05-29-2012, 03:44 PM
macropod's Avatar
macropod macropod is offline Making Line Bold Windows 7 64bit Making Line Bold Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

In your post, the lines appear to be separate paragraphs. Are they?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 05-30-2012, 09:23 AM
janith janith is offline Making Line Bold Windows XP Making Line Bold Office 2003
Novice
Making Line Bold
 
Join Date: Apr 2012
Posts: 6
janith is on a distinguished road
Default

yes they are....
Reply With Quote
  #6  
Old 05-30-2012, 04:04 PM
macropod's Avatar
macropod macropod is offline Making Line Bold Windows 7 64bit Making Line Bold Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I am unable to reproduce that behaviour when the data are in separate paragraphs.

In case they're the same paragraph, but with manual line breaks, change:
.Text = "[!^13]@" & StrFnd & "*[^13]"
to:
.Text = "[!^13^11]@" & StrFnd & "*[^13^11]"
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bold numerals whilst typing normally! ianl1532 Word 2 02-20-2012 10:20 PM
Making Line Bold How to automate BOLD in a line madbrit Word 5 07-02-2011 06:43 PM
Making Line Bold Making Multiple Words Bold mtk989 Word 2 06-25-2011 11:27 AM
Can't use Bold and Italic khmerguy Word 3 03-31-2011 12:48 PM
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 12:46 PM.


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