如何在VBA中打开多个文件输出?如果我使用
打开OutFile输出为outputFile
在关闭我之前打开的文件之前,我得到了
运行时错误' 55':
文件已经打开。
但我需要同时写两个文件...否则我需要在写入文件之前有一些缓冲区,我不知道如何创建,因为我不是VBA开发人员...
编辑:
' insert file
insertOutputFile = ThisWorkbook.Path & ("/something" + ".insert_emergency" + emergencyNumber + "_" + getConnectionAsString(connection) + fileExtension)
'set and open file for output
insertFile = FreeFile()
Open insertOutputFile For Output As insertFile
' delete file
deleteOutputFile = ThisWorkbook.Path & ("/something" + ".insert_emergency" + emergencyNumber + "_" + getConnectionAsString(connection) + fileExtension)
'set and open file for output
deleteFile = FreeFile()
Open deleteOutputFile For Output As deleteFile
' do logic with both files simultaneously
'save
Close #deleteFile
Close #insertFile