Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
How can I know if a file is an Word/Excel file, when the file does not have the doc/xls extension? I have a folder with a lot of files and all them without extension (xls, doc, txt, .). How can I know witch these files are Word or Excel files? Thanks, Rui |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You cud try something like:
From Word VBA Dim o As Object, fName As String With Application.FileSearch .NewSearch .LookIn = "c:\temp\test" .FileName = "*.*" .Execute For x = 1 To .FoundFiles.Count fName = .FoundFiles(x) Set o = GetObject(fName) On Error GoTo ErrUnkown Debug.Print fName, o.Parent Next End With Set o = Nothing Exit Sub ErrUnkown: Debug.Print fName, "Unkown" Resume Next Resulting in following lines in the Immediate Window C:\temp\test\NoExtensionWD Microsoft Word C:\temp\test\NoExtensionXL Microsoft Excel Note: files have no extension. Krgrds, Perry "Rui Oliveira" wrote in message ... Hi, How can I know if a file is an Word/Excel file, when the file does not have the doc/xls extension? I have a folder with a lot of files and all them without extension (xls, doc, txt, .). How can I know witch these files are Word or Excel files? Thanks, Rui |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Determine Excel file version with no file extension. | Excel Discussion (Misc queries) | |||
Identify an Word/Excel file without the doc/xls extension | Excel Programming | |||
Identify an Word/Excel file without the doc/xls extension | Excel Programming | |||
Identify an Word/Excel file without the doc/xls extension | Excel Programming | |||
Excel File Extension | Excel Programming |