RAJESH1960
Banned for repeated rules violations
- Joined
- Mar 26, 2020
- Messages
- 2,313
- Office Version
- 2019
- Platform
- Windows
' write to temp file
usr = Environ("username")
strTempFile = "C:\Users\" & usr & "\Desktop\Master.xml"
With CreateObject("Scripting.FileSystemObject")
' true to overwrite existing temp file
.CreateTextFile(strTempFile, True).write strData
End With
This is just a part of the code. Everytime I run the code stops at .CreateTextFile(strTempFile, True).write strData and show an error as follows -
Run time error ‘5’:
Invalid procedure call or argument.
usr = Environ("username")
strTempFile = "C:\Users\" & usr & "\Desktop\Master.xml"
With CreateObject("Scripting.FileSystemObject")
' true to overwrite existing temp file
.CreateTextFile(strTempFile, True).write strData
End With
This is just a part of the code. Everytime I run the code stops at .CreateTextFile(strTempFile, True).write strData and show an error as follows -
Run time error ‘5’:
Invalid procedure call or argument.