Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 04-16-2016, 03:09 AM
macropod's Avatar
macropod macropod is offline Macro help - converting proprietary encoding to unicode, keep formatting Windows 7 64bit Macro help - converting proprietary encoding to unicode, keep formatting Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Try running the following macro from the document you want to convert.
Code:
Sub EgyptReformatter()
Application.ScreenUpdating = False
Dim FRDoc As Document, FRList, j As Long
Set FRDoc = Documents.Open("C:\Users\" & Environ("UserName") & "\Documents\Egypt List.txt", _
  ReadOnly:=True, Addtorecentfiles:=False, Visible:=False)
FRList = FRDoc.Range.Text
FRDoc.Close False: Set FRDoc = Nothing
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .MatchWholeWord = True
  .MatchCase = True
  For j = 0 To UBound(Split(FRList, vbCr)) - 1
    If InStr(FRList, vbTab & vbTab) > 0 Then
      If Split(Split(FRList, vbCr)(j), vbTab)(6) > 0 Then
        .Text = Split(Split(FRList, vbCr)(j), vbTab)(0)
        .Replacement.Text = Split(Split(FRList, vbCr)(j), vbTab)(3)
        .Execute Replace:=wdReplaceAll
        DoEvents
      End If
    End If
  Next
End With
Application.ScreenUpdating = True
End Sub
As coded, the macro expects to find the 'Egypt List.txt' file in the user's 'Documents' folder.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro help - converting proprietary encoding to unicode, keep formatting Fixing/stabilizing/setting/securing/converting markup of tracked changes into "hard" formatting paulkaye Word 6 08-20-2015 02:36 AM
Macro help - converting proprietary encoding to unicode, keep formatting Custom Dictionary & Unicode encoding? markus staubmann Word 3 03-28-2012 05:23 AM
Macro help - converting proprietary encoding to unicode, keep formatting Outlook macro for automatically converting plain text to link? nrogers64 Outlook 1 09-17-2010 01:35 AM
Macro help - converting proprietary encoding to unicode, keep formatting Unicode Encoding Type Rose44 Excel 2 08-09-2009 09:05 PM
Having some formatting issues after converting PDF to .doc amf25 Word 1 06-05-2009 02:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:16 PM.


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