MS Access VBA 如何在Excel中删除一行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7069119/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 13:47:53 来源:igfitidea点击:
MS Access VBA How to delete a row in Excel
提问by Bruno
I have used the below code to open an Excel file in MS Access 2003. I would like to delete row 2 or A2:K2.
我已使用以下代码在 MS Access 2003 中打开 Excel 文件。我想删除第 2 行或 A2:K2。
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open "QuotebyItem.xls", True, False
回答by Tim Williams
Dim wb as Excel.Workbook
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set wb = xlApp.Workbooks.Open("QuotebyItem.xls", True, False)
wb.Sheets(1).Rows(2).Delete
...assuming your file has only one sheet: if there might be multiple and you need to address only one of them:
...假设您的文件只有一张纸:如果可能有多个并且您只需要处理其中一张:
wb.Sheets("Sheet2").Rows(2).Delete