本文介绍了TransferText的最大文件名长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行Access 2007,如果我尝试:

Running Access 2007, if I try:

    DoCmd.TransferText TransferType:= acImportDelim,_

      SpecificationName:=" MyReportImportSpecification",_

      TableName:=" MyTableToImportTo",_

      FileName:="文本文件的完整路径,名称很长.txt"

    DoCmd.TransferText TransferType:=acImportDelim, _
      SpecificationName:="MyReportImportSpecification", _
      TableName:="MyTableToImportTo", _
      FileName:="full path to text file with really long name.txt"

,FileName包含超过64个字符的名称(但不是路径),我得到错误3125。   err.Descripion是'...真的很长的名字......'不是有效的名字。 确保它不包含无效字符或标点符号,并且
不会太长。

and the FileName contains a name (but not path) of more than 64 characters, I get errNo 3125.  The err.Descripion is '...really long name...' is not a valid name.  Make sure that it does not include invalid characters or punctuation and that it is not too long.

TransferText可以使用哪个文件名最大长度?

Is there some maximum length of file name TransferText can use?

推荐答案

为了测试我是否正确我在excel中运行宏之前得到了一个错误消息,指示最大字符数218个字符。 在这里,我将保存到我当地的c:\驱动器。

Just to test that I was correct I ran the macro before in excel and got an error message indicating the maximum number of character 218 characters.  Here I'm saving to my local c:\ drive.

 

子测试()

folder =" c:\ temp \"

for i = 1 To 1000

   FName =文件夹&字符串(i,"A")& " .xls"

   ThisWorkbook.SaveAs Filename:= FName

folder = "c:\temp\"
For i = 1 To 1000
   FName = folder & String(i, "A") & ".xls"
   ThisWorkbook.SaveAs Filename:=FName

Next i



End Sub


End Sub


这篇关于TransferText的最大文件名长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-08 00:39