作者:wyl8605204 | 来源:互联网 | 2023-05-16 06:33
Thefirstpartisnowworking[Ihavethefollowingwhichjustseemstohang;thepartthataddsde
The first part is now working [ I have the following which just seems to hang; the part that adds/deletes the module works when running in VBA I note that I'm prompted with a dialog saying 'this workbook contains links to other data sources' which I ok to, then it hangs So I tried setting the second argument to 0 and also tried 2 but still it hangs (2nd arg is UpdateLinks as can be found here ) ]
第一部分现在正在工作[我有以下似乎挂起;在VBA中运行时,添加/删除模块的部分工作我注意到我提示有一个对话框,说'此工作簿包含指向其他数据源的链接',我可以,然后它挂起所以我尝试将第二个参数设置为0并尝试了2但仍然挂起(第二个arg是UpdateLinks,可以在这里找到)]
dim objExcel
dim objWorkbook
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open( "H:\M\X\C.xls", 0 , , ,"PASSWORD!" )
Const modpath = "H:\M\V\"
Const modtest = "TEST.cls"
Const modname = "TEST"
On Error Resume Next
Dim vbcomp
Set vbcomp = ActiveWorkbook.VBProject.VBComponents(modname)
objWorkbook.VBProject.VBComponents.Remove vbcomp
objWorkbook.VBProject.VBComponents.Import modpath & modtest
objWorkbook.Save
objWorkbool.Close
set vbcomp = nothing
set objworkbook = nothing
set objExcel = nothing
edited again 14/04/2009 I have now also allowed the 'tools - macro - security - vbproject access'
再次编辑14/04/2009我现在也允许'工具 - 宏 - 安全 - vbproject访问'
The script now finishes, however, when trying to open the xls to see if the changes have been made, I get a message informing me that the sheet is locked by "account used to run script"; open 'read only'/notify
该脚本现在完成,但是,当尝试打开xls以查看是否已进行更改时,我收到一条消息,通知我该表已被“用于运行脚本的帐户”锁定;打开'只读'/通知
Why isn't it releasing control correctly**?**
为什么不正确释放控制**?**
3 个解决方案