Einzelnen Beitrag anzeigen

kompi

Registriert seit: 27. Apr 2012
Ort: Duisburg
54 Beiträge
 
Delphi 11 Alexandria
 
#8

AW: Dateieigenschaften /Titel, Thema,...) von Office 2007ff lesen

  Alt 30. Okt 2014, 20:45
Hallo norwegen60,

anbei Code mit VBA Excel 2010, der zeigt, wie man auf dsofile zugreift.

sub lesedir(adir As String)
Dim fs, f, fd, fe
Dim docliste
Dim i As Integer
Dim ws As Worksheet
Dim s, s1 As String
Dim actsheet As Worksheet
Dim objfile As DSOFile.OleDocumentProperties
Dim csum As DSOFile.SummaryProperties
Dim ks As String
Dim k As Integer
Set actsheet = ActiveSheet
Set fs = CreateObject("Scripting.Filesystemobject")
Set f = fs.getfolder(adir)
Set fd = f.Files
Set ws = Worksheets("Dokumente")
Set docliste = ws.Range("Dokumentenliste")
docliste.ClearContents
Set objfile = CreateObject("DSOFile.oledocumentproperties")
i = 1
Application.ScreenUpdating = False
ws.Select
For Each fe In fd
s = fe.Name
s1 = fe.Type
If InStr(1, s1, "Microsoft Word") > 0 Then
On Error GoTo weiter1
ks = Left(s, 3)
k = CInt(ks)
docliste(k, 2) = s
objfile.Open (adir & "\" & s)
Set csum = objfile.SummaryProperties
docliste(k, 1) = csum.Title
objfile.Close
i = i + 1
weiter1:
On Error GoTo 0
End If
Next fe
Set csum = Nothing
Set objfile = Nothing
Set docliste = Nothing
Set fd = Nothing
Set f = Nothing
Set fs = Nothing
actsheet.Select
Application.ScreenUpdating = True
End Sub

Ich hoffe, das hilft Dir Dein VB Problem auch noch zu lösen.

Im übrigen kann man dies genauso mit Delphi lösen. Man muss nicht umständlich eine .._tlb - Datei erstellen.

Gruß Kompi
Detlef Schmitz
  Mit Zitat antworten Zitat