View Single Post
 
Old 11-20-2018, 09:15 AM
VBorNotVB VBorNotVB is offline Mac OS X Office 2016 for Mac
Novice
 
Join Date: Oct 2018
Location: Southern California
Posts: 25
VBorNotVB is on a distinguished road
Default

I believe the following function will solve your problem:

Code:
Function CanSaveDocAsTxt() As Boolean
    Dim i As Integer
    With ActiveDocument
        For i = 1 To .Characters.Count
            .Characters(i).Select
            'if AscW(.characters(i).Text) > 127 then exit function
            With Dialogs(wdDialogInsertSymbol)
                If .Font <> "(normal text)" Then Exit Function
            End With
        Next i
    End With
    CanSaveDocAsTxt = True
End Function
It goes through all characters in the active document and returns True if all characters in the document are part of (normal text) character set. Bear in mind that this character set has ANSI characters (character code points between 128 and 255). If you want to limit your text file to characters in ASCII range (0-127), then uncomment the commented statement above. This function does not check the document for shapes (images, etc.) - But I assume you know which documents do!

Last edited by macropod; 11-20-2018 at 01:55 PM. Reason: Added code tags to restore formatting
Reply With Quote