检查工作簿是否打开和关闭(如果是) [英] Check if Workbook is open and close if it is

查看:94
本文介绍了检查工作簿是否打开和关闭(如果是)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查找将检查特定Excel工作簿是否已打开的VBscript,方法是传递变量名称以检查带有路径的完整文件名。如果它是打开的,它会关闭它。

Looking for VBscript that will check to see if a specific Excel work book is open, by passing a variable name to check for which is the full file name with path. If it is open, it closes it.

推荐答案


寻找VBscript,它将检查是否有特定的Excel工作簿是打开的,通过传递变量名来检查哪个是带路径的完整文件名。如果它是打开的,它会关闭它。
Looking for VBscript that will check to see if a specific Excel work book is open, by passing a variable name to check for which is the full file name with path. If it is open, it closes it.



如何轻松实现

How about something easy

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号



寻找将检查特定Excel工作簿是否打开的VBscript,通过传递变量名来检查哪个是带路径的完整文件名。如果它是打开的,它会关闭它。
Looking for VBscript that will check to see if a specific Excel work book is open, by passing a variable name to check for which is the full file name with path. If it is open, it closes it.



关于关闭部分。


除非您是打开excel文件的人/程序,否则无法关闭它。


About the close part.

Unless you are the person/program with the excel file open, you cannot close it.


[JConsulting]


当我运行代码时,我得到运行时错误70;当我在代码行上打开文件时,权限被拒绝:


打开strFile用于输入锁定读取为intFile


由于某种原因,不会恢复因为代码告诉它错误。奇怪


关于关闭部分,只有我打开文件,因此它是我的文件。
[JConsulting]

When I run code, I get a Run Time error ''70''; Permission denied when I actually have a file open on code line which reads:

Open strFile For Input Lock Read As intFile

For some reason, won''t "resume" as code tells it to on error. Odd

About the close part, only I have the file open so it is my file.


这篇关于检查工作簿是否打开和关闭(如果是)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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