Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. gedwarren

    Test for correct file format and replace lost extension

    I'm still trying to figure out how to identify DOT, DOCX, XLS and XLSX files, but having no luck. Can anyone help? Cheers, Ged.
  2. gedwarren

    Test for correct file format and replace lost extension

    The one for RTF turned out to be simply: Public Function IsRTF(sName As String) Dim iFileNumber As Integer Dim sBuffer As String Dim lCharNumber As Long Dim sCharacter As String * 1 iFileNumber = FreeFile Open sName For Binary Access Read Shared As #iFileNumber...
  3. gedwarren

    Test for correct file format and replace lost extension

    Oh, and it seems JPEG and JPG are interchangable.
  4. gedwarren

    Test for correct file format and replace lost extension

    So I figured out the function for JPEG. Still trying to puzzle out the others. Public Function IsJPG(sName As String) Dim iFileNumber As Integer Dim sBuffer As String Dim lCharNumber As Long Dim sCharacter As String * 1 iFileNumber = FreeFile Open sName For Binary Access...
  5. gedwarren

    Test for correct file format and replace lost extension

    I've discovered that I also need to fix files missing DOT, RTF, TXT, HTM, JPEG, JPG, DOCX, DOCM, XLS, XLSX, XLSM, PPT and PPTX extensions. I'm struggling to see how I can how I can create functions to test for those from the info provided at http://www.garykessler.net/library/file_sigs.html. Is...
  6. gedwarren

    Test for correct file format and replace lost extension

    This works a treat with a Word doc, thanks. I'll post the whole thing once it's done. What tags do I use in this site to mark up text as code? Cheers, Ged. Private Sub FixExts() Dim sFileName As String Dim sExt As String sFileName = "H:\ReplaceLostExts\testDOC" If IsWordDoc(sFileName) =...
  7. gedwarren

    Test for correct file format and replace lost extension

    Thanks Ben. I've not come across Magic Numbers before. It looks like it could be a more efficient method - I wasn't sure how the code I posted above would cope with large numbers of files. I'll give it a go this evening. Cheers, Ged.
  8. gedwarren

    Test for correct file format and replace lost extension

    The code below now successfully opens the file in Word (if it's a .doc) and then closes Word and returns the file type. I've still got a bit of work ahead of me: 1. Do the same for PDF files 2. Rename the file with the correct extension 3. Set up a loop to work through a table of prath & file...
  9. gedwarren

    Test for correct file format and replace lost extension

    Thanks for your reply. This is what I've got so far just to test the function returns the right extension. I created a .doc file and saved it as "testDOC". When I run FixExts() I get an empty string returned - any ideas what I'm doing wrong? Private Sub FixExts() Dim MyCrummyFileName As...
  10. gedwarren

    Test for correct file format and replace lost extension

    I have written a VBA script that finds documents missing their file extensions (sloppy users) over a shared drive tree and writes the filename and path into a table. I now have a list of some 900 documents out of a total 120,000 on the shared drive. Most of those will be Word or pdf format. I...

Part and Inventory Search

Back
Top