语句可以写,不过一般都会失败,因为默认是不允许访问VBA对象的,示例代码:
Set Wb = NothingMyPth = "xxx.xls"Set Wb = GetObject(MyPth)With Wb.VBProject.VBComponents.Item("ThisWorkbook").CodeModule .DeleteLines 1, .CountOfLinesEnd WithWb.Close True