I'm in need of running a vbscript with an argument from a webpage. More specifically from a Sharepoint 2010 page. What I'm trying to do is to open SuperOffice and a specific document template. And in doing so, I've got this code to do just that.
startSOTemplate("Anbudsbrev")
Public Sub startSOTemplate(parameter)
Dim objSO
Set objSO = CreateObject("SuperOffice.Application")
If not (ObjSO is nothing) then
objSO.CurrentDocument.ChangeIdentity 0
objSO.CurrentDocument.SetDefaults
objSO.Context.Set "superoffice: document"
objSO.CurrentDocument.Template = objSO.Database.GetListItemByName(130, parameter)
End if
End Sub
Now, I've tried to add this script to a webpage using this code (The link will be replaced by a button later on)
<HTML>
<HEAD><TITLE>A Simple First Page</TITLE>
<SCRIPT LANGUAGE="VBScript">
<!--
Public Sub myVBFunction(parameter)
Dim objSO
Set objSO = CreateObject("SuperOffice.Application")
If not (objSO is nothing) Then
objSO.CurrentDocument.ChangeIdentity 0
objSO.CurrentDocument.SetDefaults
objSO.Context.Set "superoffice: document"
objSO.CurrentDocument.Template = objSO.Database.GetListItemByName(130, parameter)
end if
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<H3>A Simple First Page</H3><HR>
<a href="#" onclick="VBscript:myVBFunction('Anbudsbrev')">link</a>
</BODY>
</HTML>
And what happens is that I get an error on the webpage saying ActiveX component can't create object: 'SuperOffice.Application'. I know the dll is registered correctly, because it does work using a vbs-script alone.
So, my real question is this: Is a better way of achieving the same thing? Perhaps run the vbscript from a file instead? And just use the link on each button?