Group: microsoft.public.word.vba.general
From: "Graham Mayor"
Date: Saturday, April 05, 2008 2:45 AM
Subject: Re: VBA to determine Word version of a document

Try

Dim sFname As String
sFname = ActiveDocument.Name
If ActiveDocument.Saved = True Then
If Right(UCase(sFname), 2) = "CX" _
Or Right(UCase(sFname), 2) = "CM" Then
MsgBox "Word 2007"
Else
MsgBox "Not Word 2007"
End If
End If


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


EKH wrote:
> Hi,
>
> I need to create a vba macro that will provide info about which
> version (fileformat) of Word the active document was saved in.
>
> I tried the following, but no luck:
>
> Sub CheckDocType()
> 'Assuming that constants are as follows: Format 15 - docx; Format 16
> - docm If ActiveDocument.SaveFormat = 15 Or ActiveDocument.SaveFormat
> = 16 Then MsgBox "This document is a Word 2007."
> End If
> End Sub
>
> Thanks


Safety Articles | Usenet Groups | Usenet News | Bluegrass