GoGoGadgetScott
Thu Apr 29 02:00:17 CDT 2004
On Wed, 28 Apr 2004 01:51:02 -0700, John Moorhouse =
<anonymous@discussions.microsoft.com> wrote:
> We have an automated system that converts word etc to HTML, we are
> having a problem with it failing on password projected word documents.=
> (web upload, backend processing and web delivery)
>
> We have tried many options with no sucess, what we would like is a wsh=
> script / asp or other that can look at a word document and just return=
> a yes or no as to whether it is protected, we can then refuse to
> upload it, until the user has removed the protection.
>
> Thanks
>
> John
What is the environment of the automated system?
Function Word_Protected(sFilePath)
Set oWord =3D CreateObject("Word.Application")
On Error Resume Next
Set oDoc =3D oWord.Documents.Open(sFilePath,,,,"547894fsdda")
'MsgBox Err.number
'MsgBox Err.Description
If Err.number =3D 5121 Then
Word_Protected =3D True
Else
Word_Protected =3D False
End If
On Error GoTo 0
oWord.Quit
Set oDoc =3D Nothing
Set oWord =3D Nothing
End Function
Set oFSO =3D CreateObject("Scripting.FileSystemObject")
ScriptPath =3D oFSO.GetParentFolderName(WScript.ScriptFullName) & "\"
sFilePath =3D ScriptPath & "protected.doc"
MsgBox Word_Protected(sFilePath)
sFilePath =3D ScriptPath & "not protected.doc"
MsgBox Word_Protected(sFilePath)
-- =
Using M2, Opera's revolutionary e-mail client:
http://www.opera.com/m2/