#1
|
|||
|
|||
Macro that formats Skype IMs
Hello, I have a lot of Skype IM conversations stored in my PC and I want to copy them to a Word document and give them a nice formatting. I have hundreds of pages of conversations, so I need a macro to do this. However, preparing such a macro would take me a lot of work, in part because I know almost no Visual Basic. Is there a macro publicly available that formats this kind of text? It would save me dozens of hours. Thanks
|
#2
|
||||
|
||||
Hi Alonso,
I'm not aware of any such software. However, a lot of what you want could probably be done via Find/Replace (which could be rolled into a macro). Even so, without knowing how Skype IM conversations are formatted or how you want them re-formatted in Word, it's impossible to advise on how you might go about it.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hi Paul, thank you for your advice.
Quote:
Quote:
Thanks. |
#4
|
||||
|
||||
Hi Alonso,
Word's Find/Replace facility is quite amenable to macro implementation - I've posted a number of such implementaions here and in other forums, some of which extend its functionality quite markedly. Still, without knowing how Skype IMs are formatted and hpw you want them re-formatted, I can't say much more than that. If you care to post some before/after examples, maybe I can help.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Hi Paul,
I attach a Word document with some text formatted with both styles: first the Skype style and then my style. I think that it gives a general idea of what I'm looking for. Anyway, I can explain it in more detail if needed. Thanks. |
#6
|
||||
|
||||
Hi Alonso,
This should do most of what you want: Code:
Sub Skype_Reformatter() Application.ScreenUpdating = False Dim Rng As Range, StrFnd As String With ActiveDocument.Content With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "([!^13])(\[[0-9]{1,2}/[0-9]{1,2}/[0-9]{4})" .Replacement.Text = "^p\2" .Forward = True .Wrap = wdFindStop .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll .Text = "[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}" .Replacement.Text = "" .Execute End With Do While .Find.Found StrFnd = .Text Set Rng = .Paragraphs.First.Range.Duplicate With Rng On Error GoTo ParaLast Do .Text = Replace(.Text, StrFnd, "") If InStr(.Paragraphs.Last.Next.Range.Text, StrFnd) = 2 Then .MoveEnd wdParagraph, 1 Else Exit Do End If Loop ParaLast: ActiveDocument.Sections.Add Range:=Rng, Start:=wdSectionContinuous .InsertBefore vbCr & Format(StrFnd, "d") & " de " & Format(StrFnd, "mmmm") .Paragraphs.First.Next.Style = "Heading 3" End With .Start = Rng.End .Find.Execute Loop .Start = 0 With .Find .Text = "(\[ [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\])" .Execute End With Do While .Find.Found With .Words.Last.Next.Words.First .Text = UCase(Trim(Left(.Text, 1))) .Font.Bold = True End With .Text = Format(Mid(.Text, 3, Len(.Text) - 4), "h:mm AMPM") .Font.Italic = True .Collapse wdCollapseEnd .Find.Execute Loop End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
macros, skype, vba |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Template formats | ROTECH | Outlook | 0 | 07-20-2011 09:28 PM |
Help With Contracts Formats!! | SaintJustin Martyr | Word | 6 | 06-20-2011 06:19 PM |
Combining documents of different formats | Blaie | Word | 1 | 06-04-2011 06:35 PM |
Changing formats manually?? | Flabbergaster | Word | 1 | 11-03-2010 02:45 AM |
Macro for different file formats | pengyou | Office | 0 | 04-06-2010 09:27 PM |