Win7 32bit和64bit中的VBS Reg错误

时间:2022-07-25 06:36:32

I have made the following script in VBS but although it does work in windows xp & vista, I cant get it to work in win7 both 32 & 64 bit.

我在VBS中制作了以下脚本,但是虽然它在windows xp和vista中有效,但我无法在win7中使用32和64位。

set myclip = createobject("clipbrd.clipboard")
bcode = myclip.gettext
if len(bcode) > 0 then
set wb = getobject("C:\DB.xlsx")
wb.sheets("1").range("a2").value = bcode
myclip.clear
myclip.settext wb.sheets("1").range("c2")
set wb = nothing
end if
set myclip = nothing 

Through elevated cmd regsvr32 I get the

通过提升的cmd regsvr32,我得到了

Regsvr32 DllRegisterServer in clipboard.dll succeded.

clipboard.dll中的Regsvr32 DllRegisterServer成功。

However when I try to run the vbs I get the following error:

但是,当我尝试运行vbs时,我收到以下错误:

Line: 1 Char: 1 ActiveX component can't create object 'clipbrd.clipboard' Code: 800A01AD S

行:1个字符:1个ActiveX组件无法创建对象'clipbrd.clipboard'代码:800A01AD S.

Any ideas how to get passed it?

任何想法如何通过它?

1 个解决方案

#1


0  

If it registered, but can't be instantiated there may be something it expects to be able to access during creation that it cannot access. There is a comment where you got this from: "Note the constants i copied from msdn may not all be correct, or are outdated, see http://msdn.microsoft.com/en-us/library/ebwdx8yh.aspx" Based on that I suspect that one of the constant he copied from msdn is no longer available in Windows 7, or has changed, and that because of that it throws an error during creation. Just a guess, but worth checking if you have VBS source.

如果它已注册但无法实例化,那么它可能会在创建期间无法访问它。你有这样的评论:“注意我从msdn复制的常量可能都不正确,或者已经过时,请参阅http://msdn.microsoft.com/en-us/library/ebwdx8yh.aspx”我怀疑他从msdn复制的常量之一在Windows 7中不再可用,或者已经更改,因此在创建过程中会抛出错误。只是一个猜测,但值得检查你是否有VBS来源。

#1


0  

If it registered, but can't be instantiated there may be something it expects to be able to access during creation that it cannot access. There is a comment where you got this from: "Note the constants i copied from msdn may not all be correct, or are outdated, see http://msdn.microsoft.com/en-us/library/ebwdx8yh.aspx" Based on that I suspect that one of the constant he copied from msdn is no longer available in Windows 7, or has changed, and that because of that it throws an error during creation. Just a guess, but worth checking if you have VBS source.

如果它已注册但无法实例化,那么它可能会在创建期间无法访问它。你有这样的评论:“注意我从msdn复制的常量可能都不正确,或者已经过时,请参阅http://msdn.microsoft.com/en-us/library/ebwdx8yh.aspx”我怀疑他从msdn复制的常量之一在Windows 7中不再可用,或者已经更改,因此在创建过程中会抛出错误。只是一个猜测,但值得检查你是否有VBS来源。