A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Using AppleScriptTask to run Apple Script but can not close access of a file
Hello everyone ,
I encounter a problem that using the AppleScriptTask to run Apple Script but can not close access of a file,
My VBA code is below:
Sub createFile()
Dim RunMyScript
RunMyScript = AppleScriptTask("wfile.scpt", "hl", "parm")
End Sub
and my Apple Script is below:
on hl(parm1)
Set theFile To (path To desktop As text) & "congtou4.csv"
Set referenceNumber To Open For access theFile With Write permission
Write "aa,bb,cc,dd,ee" To referenceNumber
display dialog "rnum is :" & referenceNumber
try
Close access referenceNumber
on error errText number errNum
display dialog errText & errNum
End try
display dialog "close ok"
End hl
I tested many times , the file was created and there was data in the file
but the close access statement , I got an error : Parameter error -50
I can only invoke AppleScriptTask once to write, the second time I got the error that the file is open, can anyone help to close the access ? Thanks !
Microsoft 365 and Office | Excel | For home | Windows
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.