I'm trying to implement this script so users can right click a file and Send to NetDocuments (our cloud-based document management service). It works on our Terminal Server and on Windows XP clients. On my Win7x64 machine, I get the error:
Script: C:\Users\Matt\Downloads\NetDocuments.vbs
Line: 7
Char: 1
Error: Could not create object named "ND.ActiveDoc".
Code: 80040154
Source: WScript.CreateObject
Here is the full script:
Option Explicit
Const AsyncTimeout = 3, AsyncSuccess = 0
'*** Instantiate an Active Document object
Dim ad
Set ad = WScript.CreateObject( "ND.ActiveDoc" )
Dim intanswer
Dim docList, i, asyncStatus
Dim fso, fso2, aFile, objArgs, StrArg
Dim argcount
Set fso = CreateObject("Scripting.FileSystemObject")
Set fso2 = CreateObject("Scripting.FileSystemObject")
docList = "<DOCUMENTLIST>"
set objArgs = WScript.Arguments
argcount = WScript.Arguments.Count
if argcount > 40 then
Msgbox("Too many documents at once, the limit is 40")
else
' *** Loop through each argument and create document list
for each strArg in objArgs
' WScript.Echo strArg
strarg = replace(strarg,"&", "&")
doclist = doclist & "<DOCUMENT><LOCATION>" & strArg & "</LOCATION></DOCUMENT>"
next
docList = docList & "</DOCUMENTLIST>"
' *** Make Backup Copies of the files w/.BAK extension
for each strArg in objArgs
fso.CopyFile StrArg, StrArg & ".bak"
next
' *** Import the Documents
ad.Import docList, "new document"
' *** Wait for the import to complete
i = 0
do
asyncStatus = ad.WaitForCompletion( 300 )
i = i + 1
loop while i < 18 and asyncStatus = AsyncTimeout
' *** Check to see if import was successful
if asyncStatus = AsyncSuccess then
' *** prompt the user to delete the original documents
intanswer = MsgBox("Import Succeeded - Delete Originals?", vbyesno,"NetDocuments Import")
if intanswer = vbyes then
' *** if yes, delete
for each strArg in objArgs
Set fso2 = CreateObject("Scripting.FileSystemObject")
Set aFile = fso2.GetFile(strArg & ".bak")
aFile.Delete
next
else
' *** if no, rename .bak files back to original
for each strArg in objArgs
Set aFile = fso.GetFile(strArg & ".bak")
aFile.Move strArg
next
end if
else
' *** if not, put the original files back
WScript.Echo "Import Failed"
for each strArg in objArgs
Set aFile = fso.GetFile(strArg & ".bak")
aFile.Move strArg
next
end if
end if
Question
ttam
I'm trying to implement this script so users can right click a file and Send to NetDocuments (our cloud-based document management service). It works on our Terminal Server and on Windows XP clients. On my Win7x64 machine, I get the error:
Script: C:\Users\Matt\Downloads\NetDocuments.vbs Line: 7 Char: 1 Error: Could not create object named "ND.ActiveDoc". Code: 80040154 Source: WScript.CreateObject
Here is the full script:
Link to comment
https://www.neowin.net/forum/topic/913100-vbscript-error-in-win7-x64-only/Share on other sites
1 answer to this question
Recommended Posts