Accessing an ActiveX Control via VBScript on a SharePoint Page

I am using activeX element for PDF-XChange Viewer software.

Their support team gave me the following code example:

<html>
<head>
<title>PDF-XChange Viewer ActiveX test...</title>
<script language="VBScript">
    Sub btnGetProperty_OnClick()
        PXCV.OpenDocument "/sandpit/appsheet/faxcentre2/Faxes/1234-56789-abc-123-3.pdf", 0, 0, 0
    End Sub
</script>
</head>
<body>

<input type="button" id="btnGetProperty" value="Open document"></br>
<object id="PXCV" classid="CLSID:FE36F0F3-F082-41B7-9EED-772505A7C054" width="500" height="480">
</object>

</body>
</html>

      

And this works great in our standard browser (IE7), which is acceptable as it is an internal project.

However, if I add this to a standard SharePoint page, edit it with the SharePoint designer and add VBScript to the AdditionalPageHead content area, and the INPUT and OBJECT tags to the main content area, then the code fails.

The error is reported:

Error: Object Required: "PXCV"

Does anyone know what could be different between the two? Obviously the SP includes a lot of other scripts and controls, and the PXCV object is in a very different way in the DOM, maybe that's a problem. Or is it better to do it with the presence of other scripts (all Javascript as far as I know) on the page?

+1


a source to share


1 answer


Most likely, the SharePoint web app does not load code when it runs. I assume you will have to include the base dll in the SharePoint or GAC recycle bin. Then you will need to edit the appropriate web.config file to register the control as a "safe control".



+1


a source







All Articles