My application is generating a csv file that I want to move to another directory when user clicks export button.
My VBScript code is:
Sub ExportTocsv()
Dim oDLG
Set fso = CreateObject("Scripting.FileSystemObject")
Set oDLG=CreateObject("MSComDlg.CommonDialog")
Set file = fso.OpenTextFile("results.csv", 1)
text = file.ReadAll
file.Close
With oDLG
.DialogTitle="SaveAs"
.Filter="Comma Separated Version|*.csv;|Text Files|*.txt|All files|*.*"
.MaxFileSize=255
.ShowSave
If .FileName<>"" Then
FileName=.FileName
Set objOutFile = fso.CreateTextFile(FileName,True)
objOutFile.write(text)
objOutFile.close
End If
End With
Set oDLG=Nothing
End Sub
It gives me an error message "ActiveX component can't create object". What is solution or workaround for this?
I can't install anything in my environment.