excel - 我无法追踪崩溃问题,因为 VBA 一直给我一个“无法进入中断模式”错误
问题描述
我有一个包含 10,000 个行文件的长宏。最后我尝试 fileSaveName。如果我只运行宏,它会一直崩溃。我无法追踪出了什么问题,因为如果我单步执行,我会在保存代码附近的任何地方看到“无法进入中断模式”。如果我“跑到光标”,也会发生同样的事情。然后当我点击“继续”时,宏运行到最后就好了。
当我放入“Debug.Assert”中断时,单击“继续”后宏运行良好。
'获取活动工作簿文件夹,如果保存
strPath = wbA.Path
If strPath = "" Then
strPath = Application.DefaultFilePath
End If
strPath = strPath & "\"
'为保存文件创建默认名称
strFile = QuoteNo & " - OEM List"
strPathFile = strPath & strFile
'现在用消息框保存
fileSaveName = Application.GetSaveAsFilename(InitialFileName:=strFile, FileFilter:="Excel workbook (*.xlsx), *.xlsx", Title:="Save with this file name or Create a new name")
If fileSaveName <> False Then
ActiveWorkbook.SaveAs Filename:=fileSaveName
End If
只需逐步完成文件重新格式化和过滤并保存文件而不会破坏。
解决方案
推荐阅读
- html - 如何将整个div移到右侧
- kubernetes - Kubernetes 端口转发 - 侦听 tcp4 127.0.0.1:88 时出错:绑定:权限被拒绝
- oracle - 如何在 bi 发布者中生成 csv 文件
- amazon-web-services - 如何配置 Hive EMR 以使用 S3 作为默认文件系统和仓库
- ruby-on-rails - SignatureDoesNotMatch - Amazon s3 无法上传图片
- ruby-on-rails - 为什么nginx会给出请求超时错误
- django - 将 Django 项目升级到 Python3 - 迁移失败
- azure - 使用 ARM 在 API 管理中创建 AAD 用户也会创建 Basic
- python - 在 OpenCV python 中对锯齿曲线执行曲线拟合
- php - 如何使用 angular2 和 php 在 mysql 数据库中保存图像