Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
936to940
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
936to940
936to940
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

besitzer auslesen aus hyperlink-Liste

besitzer auslesen aus hyperlink-Liste
23.12.2007 21:46:18
stefan
Hallo und herzliche vorweihnachtliche Grüße
ich habe eine Excel 2003 Datei, in der in Spalte B mehrere tausend Dateien (xls, doc, ppt und weitere)
per hyperlink aufgeführt sind.
Ich möchte nun der Formel / Funktion / VBA den Besitzer der jeweiligen Dateien auslesen und
in Spalte C eintragen.
Gibt es so eine Möglichkeit ?
Für mich über ein "Weihnachtsgeschenk" sehr freuen :=)
Vorab besten Dank und Gruß
Stefan

9
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: besitzer auslesen aus hyperlink-Liste
23.12.2007 21:49:00
Gerd
Hi,
was ist denn der Besitzer, welche Eigenschaft soll das sein?
mfg Gerd

Besitzer = Letzter, der die Datei gespeichert hat
23.12.2007 21:56:01
stefan
Hallo Gerd,
ja, da war ich wohl zu schnell / unklar mit meiner Formulierung.
- der, der die Datei zuletzt gespeichert hat
Klasse wäre natürlich auch die Info
- der, der die Datei erstellt hat - wäre aber nur ein "Addon" und ist z.Zt. nicht so wichtig
Ich benötige die Infos um VOR einer Löschung / Verschiebung von Dateien den jeweiligen "Besitzer" vorher anzusprechen. Die Dateien liegen alle auf einem Netzwerkverzeichnis.
Gruss
Stefan

AW: Besitzer = Letzter, der die Datei gespeichert hat
23.12.2007 22:19:00
Dan
Hi,
alle Eigenschaften lesen, vorausgesetzt, sie wurden nicht mit den Sicherheitsoptionen vor dem
Speichern gelöscht.

Sub Eigenschaften()
Dim z As Byte, p As Variant
z = 1
Sheets(1).Activate
For Each p In ActiveWorkbook.BuiltinDocumentProperties
On Error Resume Next
Cells(z, 1).Value = "Eingebaute Eigenschaft"
Cells(z, 2).Value = p.name
Cells(z, 3).Value = p.Value
z = z + 1
On Error GoTo 0
Next
For Each p In ActiveWorkbook.CustomDocumentProperties
On Error Resume Next
Cells(z, 1).Value = "Benutzereigenschaft"
Cells(z, 2).Value = p.name
Cells(z, 3).Value = p.Value
z = z + 1
Next
End Sub


mfg Dan

Anzeige
many thx - aber das hilft nur bei der aktuellen ..
23.12.2007 23:42:00
stefan
Datei !?!
Hallo Dan,
vielen Dank für deinen Code - den werd ich mir mal speichern, weil es gut ist !!!
Nur hilft er mir nicht weiter bei meiner frage:
Besitzer einer link-Liste einfügen
oder steh ich heut auf dem Schlauch ?
Besten Gruß
Stefan

AW: many thx - aber das hilft nur bei der aktuellen ..
24.12.2007 00:49:00
Herby
Hallo Stefan,
um die Dateieigenschaften auszulesen ist es, wenn ich Dan richtig verstehe, erforderlich
jede betroffene Datei zu öffnen. Dh. es ist anhand des Links die Datei zu ermitteln, zu öffnen,
auszulesen und wieder zu schließen. Natürlich den ausgelesenen Text auch noch speichern.
Viele Grüße
Herby

Anzeige
bei Windows NT ging das so > aber bei XP ?
25.12.2007 13:59:39
stefan
Ein weihnachtliches Hallo
alle Dateien öffnen und wieder schliessen ist schier unmöglich, da es ca 15.000 Dateien sind.
Ich hatte bislang - und da hab ich auf Windows NT gearbeitet - es mit einer Funktion (s.u.) gelöst.
Wir sind jetzt in der Firma auf XP umgestiegen und da funktioniert diese Funktion leider nicht mehr
... oder müsste da etwas verändert werden ?
Hat noch jemand eine andere Idee ?
Gruss Stefan
hier der Code (Quelle: http://www.devx.com/vb2themax/Tip/19292)
Expertise: Advanced
Language: VB5,VB6,WinNT
July 14, 2001
GetFileOwner - Get the owner of an NTFS file
Private Declare

Function GetFileSecurity Lib "advapi32.dll" Alias _
"GetFileSecurityA" (ByVal lpFileName As String, ByVal RequestedInformation _
As Long, pSecurityDescriptor As Byte, ByVal nLength As Long, _
lpnLengthNeeded As Long) As Long
Private Declare 

Function GetSecurityDescriptorOwner Lib "advapi32.dll" _
(pSecurityDescriptor As Any, pOwner As Long, lpbOwnerDefaulted As Long) As _
Long
Private Declare 

Function LookupAccountSid Lib "advapi32.dll" Alias _
"LookupAccountSidA" (ByVal lpSystemName As String, ByVal Sid As Long, _
ByVal name As String, cbName As Long, ByVal ReferencedDomainName As String, _
cbReferencedDomainName As Long, peUse As Long) As Long
Private Declare 

Function GetWindowsDirectory Lib "kernel32" Alias _
"GetWindowsDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Const OWNER_SECURITY_INFORMATION = &H1
Const ERROR_INSUFFICIENT_BUFFER = 122&
Const MAX_PATH = 255
' return the name of the file owner
' runs over Windows NT or 2000, and works only with files in NTFS partitions


Function GetFileOwner(ByVal szfilename As String) As String
Dim bSuccess As Long       ' Status variable
Dim sizeSD As Long         ' Buffer size to store Owner's SID
Dim pOwner As Long         ' Pointer to the Owner's SID
Dim ownerName As String    ' Name of the file owner
Dim domain_name As String  ' Name of the first domain for the owner
Dim name_len As Long       ' Required length for the owner name
Dim domain_len As Long     ' Required length for the domain name
Dim sdBuf() As Byte        ' Buffer for Security Descriptor
Dim nLength As Long        ' Length of the Windows Directory
Dim deUse As Long          ' Pointer to a SID_NAME_USE enumerated type
' indicating the type of the account
' Call GetFileSecurity the first time to obtain the size of the buffer
' required for the Security Descriptor.
bSuccess = GetFileSecurity(szfilename, OWNER_SECURITY_INFORMATION, 0, 0&, _
sizeSD)
' exit if any error
If (bSuccess = 0) And (Err.LastDllError  ERROR_INSUFFICIENT_BUFFER) Then _
Exit Function
' Create a buffer of the required size and call GetFileSecurity again
ReDim sdBuf(0 To sizeSD - 1) As Byte
' Fill the buffer with the security descriptor of the object specified by
' the
' filename parameter. The calling process must have the right to view the
' specified
' aspects of the object's security status.
bSuccess = GetFileSecurity(szfilename, OWNER_SECURITY_INFORMATION, sdBuf(0), _
sizeSD, sizeSD)
' exit if error
If bSuccess = 0 Then Exit Function
' Obtain the owner's SID from the Security Descriptor, exit if error
bSuccess = GetSecurityDescriptorOwner(sdBuf(0), pOwner, 0&)
If bSuccess = 0 Then Exit Function
' Retrieve the name of the account and the name of the first domain on
' which this SID is found.  Passes in the Owner's SID obtained previously.
' Call LookupAccountSid twice, the
' first time to obtain the required size of the owner and domain names.
bSuccess = LookupAccountSid(vbNullString, pOwner, ownerName, name_len, _
domain_name, domain_len, deUse)
' exit if any error
If (bSuccess = 0) And (Err.LastDllError  ERROR_INSUFFICIENT_BUFFER) Then _
Exit Function
'  Allocate the required space in the name and domain_name string variables.
' Allocate 1 byte less to avoid the appended NULL character.
ownerName = Space(name_len - 1)
domain_name = Space(domain_len - 1)
'  Call LookupAccountSid again to actually fill in the name of the owner
' and the first domain.
bSuccess = LookupAccountSid(vbNullString, pOwner, ownerName, name_len, _
domain_name, domain_len, deUse)
If bSuccess = 0 Then Exit Function
' we've found a result
GetFileOwner = ownerName
End Function


Anzeige
bei Windows NT ging das so > aber bei XP ?
25.12.2007 14:00:18
stefan
Ein weihnachtliches Hallo
alle Dateien öffnen und wieder schliessen ist schier unmöglich, da es ca 15.000 Dateien sind.
Ich hatte bislang - und da hab ich auf Windows NT gearbeitet - es mit einer Funktion (s.u.) gelöst.
Wir sind jetzt in der Firma auf XP umgestiegen und da funktioniert diese Funktion leider nicht mehr
... oder müsste da etwas verändert werden ?
Hat noch jemand eine andere Idee ?
Gruss Stefan
hier der Code (Quelle: http://www.devx.com/vb2themax/Tip/19292)
Expertise: Advanced
Language: VB5,VB6,WinNT
July 14, 2001
GetFileOwner - Get the owner of an NTFS file
Private Declare

Function GetFileSecurity Lib "advapi32.dll" Alias _
"GetFileSecurityA" (ByVal lpFileName As String, ByVal RequestedInformation _
As Long, pSecurityDescriptor As Byte, ByVal nLength As Long, _
lpnLengthNeeded As Long) As Long
Private Declare 

Function GetSecurityDescriptorOwner Lib "advapi32.dll" _
(pSecurityDescriptor As Any, pOwner As Long, lpbOwnerDefaulted As Long) As _
Long
Private Declare 

Function LookupAccountSid Lib "advapi32.dll" Alias _
"LookupAccountSidA" (ByVal lpSystemName As String, ByVal Sid As Long, _
ByVal name As String, cbName As Long, ByVal ReferencedDomainName As String, _
cbReferencedDomainName As Long, peUse As Long) As Long
Private Declare 

Function GetWindowsDirectory Lib "kernel32" Alias _
"GetWindowsDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Const OWNER_SECURITY_INFORMATION = &H1
Const ERROR_INSUFFICIENT_BUFFER = 122&
Const MAX_PATH = 255
' return the name of the file owner
' runs over Windows NT or 2000, and works only with files in NTFS partitions


Function GetFileOwner(ByVal szfilename As String) As String
Dim bSuccess As Long       ' Status variable
Dim sizeSD As Long         ' Buffer size to store Owner's SID
Dim pOwner As Long         ' Pointer to the Owner's SID
Dim ownerName As String    ' Name of the file owner
Dim domain_name As String  ' Name of the first domain for the owner
Dim name_len As Long       ' Required length for the owner name
Dim domain_len As Long     ' Required length for the domain name
Dim sdBuf() As Byte        ' Buffer for Security Descriptor
Dim nLength As Long        ' Length of the Windows Directory
Dim deUse As Long          ' Pointer to a SID_NAME_USE enumerated type
' indicating the type of the account
' Call GetFileSecurity the first time to obtain the size of the buffer
' required for the Security Descriptor.
bSuccess = GetFileSecurity(szfilename, OWNER_SECURITY_INFORMATION, 0, 0&, _
sizeSD)
' exit if any error
If (bSuccess = 0) And (Err.LastDllError  ERROR_INSUFFICIENT_BUFFER) Then _
Exit Function
' Create a buffer of the required size and call GetFileSecurity again
ReDim sdBuf(0 To sizeSD - 1) As Byte
' Fill the buffer with the security descriptor of the object specified by
' the
' filename parameter. The calling process must have the right to view the
' specified
' aspects of the object's security status.
bSuccess = GetFileSecurity(szfilename, OWNER_SECURITY_INFORMATION, sdBuf(0), _
sizeSD, sizeSD)
' exit if error
If bSuccess = 0 Then Exit Function
' Obtain the owner's SID from the Security Descriptor, exit if error
bSuccess = GetSecurityDescriptorOwner(sdBuf(0), pOwner, 0&)
If bSuccess = 0 Then Exit Function
' Retrieve the name of the account and the name of the first domain on
' which this SID is found.  Passes in the Owner's SID obtained previously.
' Call LookupAccountSid twice, the
' first time to obtain the required size of the owner and domain names.
bSuccess = LookupAccountSid(vbNullString, pOwner, ownerName, name_len, _
domain_name, domain_len, deUse)
' exit if any error
If (bSuccess = 0) And (Err.LastDllError  ERROR_INSUFFICIENT_BUFFER) Then _
Exit Function
'  Allocate the required space in the name and domain_name string variables.
' Allocate 1 byte less to avoid the appended NULL character.
ownerName = Space(name_len - 1)
domain_name = Space(domain_len - 1)
'  Call LookupAccountSid again to actually fill in the name of the owner
' and the first domain.
bSuccess = LookupAccountSid(vbNullString, pOwner, ownerName, name_len, _
domain_name, domain_len, deUse)
If bSuccess = 0 Then Exit Function
' we've found a result
GetFileOwner = ownerName
End Function


Anzeige
Docproperty auslesen mit DSOFile 2.1
25.12.2007 22:17:00
Herby
Hallo Stefan,
bei vielen Dateien ist es vielleicht eine Alternative, die Dateieigenschaften über
DSOFile auszulesen. Microsoft bietet diese Active-X Datei DSOFile.dll zum Download an.
auf Basis dieser Datei kannst du auf alle Dokumenteigenschaften zugreifen. Ich denke
dass es schneller geht, als das Öffnen, Auslesen und Schließen per VBA zu machen. Ob
es für dich eine sinnvolle Alternative ist, kann ich nicht beurteilen.
Du kannst ja unter Google nach DSOFile suchen und ggf. das Teil mal installieren.
Im VBA-Editor dann den Verweis nicht vergessen.
Ach ja, ich hab mal den von dir geposteten Code ausprobiert. Bei mir unter XP-Home läuft er
ohne Probleme. Wo bleibt er denn bei dir hängen ?
Viele Grüße
Herby

Anzeige
AW: Docproperty auslesen mit DSOFile 2.1
26.12.2007 16:47:00
stefan
Hallo Herby
vielen Dank für Deinen Tip. Das werd ich mal probieren
- hoffentlich funktioniert ActiveX - sind meines Erachtens bei uns "gesperrt" - ich schau mal
- meine Feedback kommt aber erst im neuen Jahr
... Urlaub ;=)
Ich weiß nich, warum der Code in der Firma nicht funktioniert.
Da fällt mir gerade ein - muss ich in VBA vielleicht einen Verweis setzen ? Wenn ja, welchen ?
Wenn Du eine Idee dazu hast: gerne "her damit" ;=)
Dir noch einen schönen Weihnachtstag
Gruß Stefan

303 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige