#1
|
|||
|
|||
Insert Tabs Between words
How can we do a replace by format when we want to find a space between words in Microsoft Word that the first word has a different font then the second?
Example: word1 Word2 we want to put a tab in the space between the 2 words We have the following macro but only works on first line Sub ScratchMacro() Dim oWord As Range Dim oRgn As Range For Each oWord In ActiveDocument.Range.Words If oWord.Font.Name = "Tahoma" Then If oWord <> vbTab Then On Error GoTo Err_Handler If oWord.Words.Last.Next.Font.Name = "Times New Roman" Then oWord = Replace(oWord, " ", vbTab) End If End If End If Next oWord lbl_Exit: Exit Sub Err_Handler: Resume lbl_Exit End Sub |
#2
|
||||
|
||||
hi lkatz1,
If you don't care what the following font is, you can do this without a macro, using an ordinary Find/Replace procedure, where: Find = no text specified, but just the font of interest Replace = ^&^t
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Removing tabs | Taylor | Word | 10 | 11-28-2011 03:38 PM |
Outlook Calendar tabs in 2011 | solomani | Outlook | 2 | 07-15-2011 08:30 PM |
Why Words doesn’t show the style of the selected words automatically???? | Jamal NUMAN | Word | 0 | 04-14-2011 03:20 PM |
Help with tabs | kapnasty | Word | 9 | 01-24-2011 01:25 PM |
Adjusting Tabs | erselking | Word | 1 | 10-23-2008 02:57 PM |