Consulting

Results 1 to 4 of 4

Thread: Convert DOS doc in-line footnotes to Word bottom of page ones - Help with Macro

  1. #1
    VBAX Regular
    Joined
    Jan 2021
    Posts
    10
    Location

    Convert DOS doc in-line footnotes to Word bottom of page ones - Help with Macro

    Hi,I need help converting 1980s DOS word processor documents into Microsoft Word 2016 documents. Word opens these documents. Text is read as text and the formatting characters are translated as extended Ascii characters as shown here:
    Historical studies are still undertaken and judged with a very different logic than are sociological ones. Conversely, sociologists who study history have quite different methodological orientations than do historians.ÀÆÏÏÔûVictoria E. Bennett, "The Uses of Theory. Concepts and Comparison in Historical Sociology", ÀÉûComparative Studies in Society and History.ý, ÀÂû22ý, 1980.ý. Apart from a more conscious concern with quantification the kind of history that is being written today seems to be little different as far as the perspective of the historical social scientist is concerned from that which was being written fifty years ago.
    Italicized text, for example, is enclosed between the extended Ascii character string ÀÉû and ý, while bolding uses the characters ÀÂû and ý. Footnotes begin with the extended Ascii character string ÀÆÏÏÔû and end with the character ý preceded by a period (.). I have written the following VBA macro that converts the extended Ascii character string encased in-line footnotes into bottom of page Word footnotes:
    Sub FinalWordFootnotes()
    ' FinalWordFootnotes Macro
    Selection.Find.ClearFormatting
    With Selection.Find
      .Text = "&Agrave;&AElig;&Iuml;&Iuml;&Ocirc;&ucirc;*.&yacute" '<---In-line footnote enclosed in extended Ascii character stings
      .Forward = True
      .Wrap = wdFindContinue
      .Format = False
      .MatchCase = False
      .MatchWholeWord = False
      .MatchAllWordForms = False
      .MatchSoundsLike = False
      .MatchWildcards = True
      While Selection.Find.Execute
        ActiveDocument.Footnotes.Add Range:=Selection.Range, Text:=Selection.Text
      Wend
    End With
    End Sub
    (Note: the text being searched for is any text between the extended Ascii character strings &Agrave;&AElig;&Iuml;&Iuml;&Ocirc;&ucirc; and..&yacute; such as: &Agrave;&AElig;&Iuml;&Iuml;&Ocirc;&ucirc;Victoria E. Bennett, &quot;The Uses of Theory. Concepts and Comparison in Historical Sociology&quot;, &Agrave;&Eacute;&ucirc;Comparative Studies in Society and History.&yacute;, &Agrave;&Acirc;&ucirc;22&yacute;, 1980.&yacute;.)

    Unfortunately, this macro leaves the Ascii encased footnotes in the text. The bottom of page footnotes it creates also include the extended Ascii character strings. Accordingly I need to revise my macro so that it also:
    1. Creates the in-line footnotes the Word bottom of page footnotes without the extended Ascii characters strings.
    2. Once the in-line footnote has been created, delete the in-line/in-text footnote used to create it, including its extended Ascii characters.

    While I programmed extensively in Excel VBA some twenty years ago, I've largely forgotten it, and I have never written Word VBA macros. I would, then, be grateful for any suggestions and advice as to how I might revise my macro in this regard. Suggestions as to how I could automatically format my documents to bottom of page footnotes using Arabic numbers before running this macro would also be appreciated. Presently I am doing it by creating a footnote using the Word References - Insert Footnote menu before I run my macro.

    My thanks in advance for all your help, advice and suggestions.
    Last edited by macropod; 02-02-2021 at 05:39 PM. Reason: Post reformatted for intelligibility

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    For example:
    Sub FinalWordFootnotes()
    ' FinalWordFootnotes Macro
    Dim StrTxt As String
    With ActiveDocument.Range
      With .Find
        .ClearFormatting
        .Forward = True
        .Format = False
        .Wrap = wdFindContinue
        .MatchWildcards = True
        .Text = "&quot;"
        .Replacement.Text = """"
        .Execute Replace:=wdReplaceAll
        .Text = "&Agrave;&AElig;&Iuml;&Iuml;&Ocirc;&ucirc;*.&yacute*&yacute;*&yacute;"
        .Wrap = wdFindStop
      End With
      Do While .Find.Execute
        StrTxt = .Text
        .Text = vbNullString
        ActiveDocument.Footnotes.Add Range:=.Duplicate, Text:=StrTxt
      Loop
    End With
    End Sub



    Of course, it would be preferable to convert all the .&Agrave;&AElig;&Iuml;&Iuml;&Ocirc;&ucirc; and similar strings to whatever formatting characteristics those strings are supposed to represent (as I've done with the &quot; strings) and to use a different approach that preserve that formatting in the conversion. Nevertheless, it can also be done post-conversion.
    Last edited by macropod; 02-02-2021 at 06:20 PM.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    VBAX Regular
    Joined
    Jan 2021
    Posts
    10
    Location
    Thanks so much Paul.

    Let me try this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •