This is a variation of mine of a code posted by Macropod. It will only work if the text does actually have 3 spaces as stated above.
Sub PutInTable() Application.ScreenUpdating = False With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True .Text = "[\-]{5,}@[^13^l]" .Replacement.Text = "" .Execute Replace:=wdReplaceAll .Text = "([0-9/]{10}, [0-9:]{5}) ([!^13^l]@)[^13^l]([!^13^l]@[^13^l])" .Replacement.Text = "\2^t\1^t\3" .Text = " " .Replacement.Text = "vbTab" .Execute Replace:=wdReplaceAll End With .InsertBefore "Time" & vbTab & "Message" & vbTab .ConvertToTable Separator:=vbTab, NumColumns:=2, Format:=wdTableFormatGrid1, _ ApplyHeadingRows:=True, AutoFit:=True, AutoFitBehavior:=wdAutoFitWindow End With Application.ScreenUpdating = True End Sub




Reply With Quote
