我正在尝试使用DoCmd.TransferSpreadsheet
. 工作表的名称是XYZ Priority
。
我调用方法如下:
DoCmd.TransferSpreadsheet FileName:=filePath, tablename:="XYZ", _
hasfieldnames:=True, range:="[XYZ Priority]!"
我收到此错误消息:
'[XYZ Priority]$' is not a valid name. Make sure that it does not
include invalid characters or punctuation and that it is not too long.
看来空间是导致问题的原因。我尝试了几种不同的方法来识别范围,有无感叹号,但都失败了:
"XYZ Priority"
"XYZ_Priority"
"'XYZ Priority'"
我怎样才能正确地将工作表传递给TransferSpreadsheet
?