|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
以下代码报错,编译错误:错误的参数号或无效的属性赋值
'原按照这个写是没有问题的filePath = Application.GetOpenFilename("Excel Files (.xls),.xls", , "Select File to Import")
导入文件我想加一个导入框内只显示包含采购单字符的excel文件,
filePath = Application.GetOpenFilename("Excel Files (.xls),.xls", , "Select File to Import", , , False, "采购单*")
改成这样以后就报错了
Sub 采购单导入()
Dim filePath As Variant
Dim wb As Workbook
'Allow the user to select a file
filePath = Application.GetOpenFilename("Excel Files (.xls),.xls", , "Select File to Import", , , False, "采购单*")
'Exit the macro if no file was selected
If Not filePath <> False Then Exit Sub
'Open the selected file and copy the data to a new sheet named "Test"
Set wb = Workbooks.Open(filePath)
wb.Sheets(1).Copy after:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
ActiveSheet.Name = "采购单"
wb.Close False
End Sub
|
|