Windows().Activate 适用于除一台计算机之外的每台计算机 [英] Windows().Activate works on every computer except one

查看:44
本文介绍了Windows().Activate 适用于除一台计算机之外的每台计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个奇怪的问题,我在一年前制作了宏,并且每个月都在使用它,没有问题.昨天我的老板告诉我,他不能再使用它了,这给他带来了一些错误.我现在在 8 台计算机上尝试了该宏,并且该宏完美运行.为什么这个宏可以在其他人的电脑上运行,除了我的老板.

I have encountered a strange problem, I made macro about a year ago and it is being used every month without problems. Yesterday my boss told me, he cannot use it anymore, that it gives him some errors. I now tried the macro on 8 computers and the macro ran perfectly. Why is it that macro runs on everyone else's computer, except for my boss.

它的断行

Windows("MyxlsbFile").Activate

给出的错误是

运行时错误9":下标超出范围.

Run-time error '9': Subscript out of range.

推荐答案

调用(eg)时是否可以去掉文件扩展名

Whether or not you can leave off the file extension when calling (eg)

Windows("MyxlsbFile") 

Workbooks("MyxlsbFile")

取决于是否已选中 Windows 资源管理器设置隐藏已知文件类型的扩展名":如果文件扩展名显示在 Windows 资源管理器中,则您必须在调用 WorkBooks() 时包含该扩展名.

depends on whether the Windows Explorer setting "hide extensions for known file types" has been checked or not: if file extensions are shown in Windows Explorer then you must include the extension when calling WorkBooks().

我猜这是您遇到问题的一台 PC 上的问题.

I'm guessing this is the issue on the one PC where you have the problem.

包含文件扩展名总是有效的(当然只要没有其他错误)

Including the file extension always works (as long as there's no other error of course)

这篇关于Windows().Activate 适用于除一台计算机之外的每台计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆