Can VBA tell which format a document was last saved in?

E

Edward Mendelson

The subject line is the whole question: Is there a way of testing in VBA
whether a file was last saved in Word, RTF, WinWord 2.0, WordPerfect 5.x, or
some other format?

Many thanks for any help.

Edward Mendelson
 
J

Jezebel

You'll need to clarify: are you trying to determine the format used for the
last Save operation, or are you looking for a reliable way to determine the
format of a file?

If the latter, open the file for binary and read the first few bytes:

D0 CF 11 E0 A1 B1 1A E1 = Office document
7B 5C 72 74 66 31 = RTF
FF 57 50 43 = Word Perfect


Do a Google for file signatures for many more of these.
 
E

Edward Mendelson

Thanks, Jezebel. That turns out to be exactly what I need (and, for the
record, the Word for Windows 2.0 format, which is what I want to test for,
has the signature DB A5 2D).

Thanks again!

Edward Mendelson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top