Forum Moderators: open
'-------code start--------------
<%
Sub RetrieveOne(cnDB)
id=request("id")
%>
<Script Language="vbscript">
docpath = "C:\Inetpub\wwwroot\system\Proposal\<%=id %>.doc"
Set wApp = CreateObject("Word.Application")
Set oDocument = CreateObject("Word.Document")
On Error Resume Next
Set oDocument =wApp.Documents.Open(docpath)
If Err.number = 0 then
wApp.Visible = True
wApp.Documents(1).Activate
Set wApp = Nothing
End If
</script>
<%
End Sub
%>
'-------code end---------------
At the same time, I have already enable "Initalizing and Scripting ActiveX controls that are not marked safe" under Trusted Sites/Custom Level.
Hope can get reply from you all. Thanks in advance :)
Add an else to this code to make sure that you trap all conditions...
If Err.number = 0 then
wApp.Visible = True
wApp.Documents(1).Activate
Set wApp = Nothing
Else
'why am I getting an error and what is it?
response.write err.number & "<br>" & err.description
End If
Also, look into your browser security settings and make sure that your not running into an obstacle there.