2016-05-26 5 views
1

このコードはちょっとおなじみですが、このループファイルパスのプリンタコードで拡張プロパティを取得するのに問題があります。拡張プロパティをファイルから取得します

  • オブジェクトのプロパティがScripting.FileSystem object
  • を使用して取得するのは簡単です。しかし、私はエラーオブジェクトはこのプロパティまたはメソッドをサポートしていません取得、拡張プロパティを抽出しようとすると、」

私はそれが自分の殻だ作成する必要がありますか

コードは上の失敗:?

Cells(i + ROW_FIRST - 1, 3) = objFolder.GetDetailsOf(objFile, 9) 

既存のコード

'objFSO: A Scripting.FileSystem object. 
Private Function GetAllFiles(ByVal strPath As String, _ 
ByVal intRow As Integer, ByRef objFSO As Object) As Integer 
Dim objFolder As Object 
Dim objFile As Object 
Dim i As Integer 

    i = intRow - ROW_FIRST + 1 
Set objFolder = objFSO.getfolder(strPath) 
On Error Resume Next 
For Each objFile In objFolder.Files 
     'print Date created 
     Cells(i + ROW_FIRST - 1, 1) = objFile.DateCreated 
     'print file name 
     Cells(i + ROW_FIRST - 1, 2) = objFile.Name 

     'Author------>!!!! HERE IS THE PROBLEM !!!! 
     Cells(i + ROW_FIRST - 1, 3) = objFolder.GetDetailsOf(objFile, 9) 

     'print file path 
     Cells(i + ROW_FIRST - 1, 4) = objFile.Path 
     'Insert doc link 
     Cells(i + ROW_FIRST - 1, 5).Select 
    ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _ 
     objFile.Path, _ 
     TextToDisplay:=objFile.Name 

     i = i + 1 
Next objFile 
GetAllFiles = i + ROW_FIRST - 1 
End Function 

ありがとう!

答えて

0

これにはShellを使用する必要があります。

私のシステムでは著者属性は今、私はこの機能にこれを挿入したり、私が呼び出すために別の関数を作成する必要がありますcode.Canを既存にその作業支援が必要な20

Sub HoldtheDoor() 

Dim oShell As Object 
Dim oDir As Object 
Dim objFile As Object 
Set oShell = CreateObject("Shell.Application") 
Set oDir = oShell.Namespace("c:\temp") 

For Each objFile In oDir.Items 
    Debug.Print oDir.GetDetailsOf(objFile, 20) 
Next 

End Sub 
+0

ですループプロセスで? –

関連する問題