I'm using this is to remove internet zone id from files, after adding the Reference.
It was working but now I get
Run-time error '-2147467259 (80004005)':
Automation error
Unspecified error
Any idea how I can resolve ?
Thanks
Code:
Public Sub RemoveFileSecurityZone(sFile As String)
Dim pZI As PersistentZoneIdentifier
Set pZI = New PersistentZoneIdentifier
pZI.Remove
Dim pIPF As IPersistFile
Set pIPF = pZI
pIPF.Save sFile, 1
Set pIPF = Nothing
Set pZI = Nothing
End Sub
Public Function GetFileSecurityZone(sFile As String) As URLZONE
'returns the Zone Identifier of a file, using IZoneIdentifier
'This could also be done by ready the Zone.Identifier alternate
'data stream directly; readfile C:\file.txt:Zone.Identifier
On Error GoTo err_ADS
Dim lz As Long
Dim pZI As PersistentZoneIdentifier
Set pZI = New PersistentZoneIdentifier
Dim pIPF As IPersistFile
Set pIPF = pZI
pIPF.Load sFile, STGM_READ
pZI.GetId lz
GetFileSecurityZone = lz
Set pIPF = Nothing
Set pZI = Nothing
On Error GoTo 0
Exit Function
err_ADS:
End Function
Code:
If GetFileSecurityZone(CStr(files(i))) = 3 Then 'files(i) is full path plus filename
i = MsgBox("File Contains Internet Zone Identifier. Remove It ?", vbYesNo + vbQuestion, files(i))
If i = vbYes Then RemoveFileSecurityZone (CStr(files(i)))
End If
It was working but now I get
Run-time error '-2147467259 (80004005)':
Automation error
Unspecified error
Any idea how I can resolve ?
Thanks