#1
|
|||
|
|||
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... |
#2
|
||||
|
||||
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] |
#3
|
|||
|
|||
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 |
#4
|
||||
|
||||
In your post, the lines appear to be separate paragraphs. Are they?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
yes they are....
|
#6
|
||||
|
||||
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] |
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 |
How to automate BOLD in a line | madbrit | Word | 5 | 07-02-2011 06:43 PM |
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 |