I have an ODS Sheet. I have to Generate .csv file on its upload.I dont have code to generate .csv file.

Can anyone help me out in solving this?
Please find attached the sheet of whose .csv file is to be generated
Password : formvat48
Edit: You've been silent |
Code: Select all
Public Sub Generate_upload()
Dim sURL$ As String ' URL of current workbook
Dim FileN As String ' URL of target CSV-file
Dim oCurrentController As Object ' Before save - activate sheet sSheetName
Dim storeParms(2) as new com.sun.star.beans.PropertyValue ' You must delete Option VBASupport 1
REM in header of module. Otherwise, this line would be a mistake!
Const sSheetName = "VAT 48"
GlobalScope.BasicLibraries.LoadLibrary("Tools") ' Only for GetFileName
sURL = thisComponent.getURL()
FileN = GetFileNameWithoutExtension(sURL) & ".csv"
REM Options to StoreTo:
storeParms(0).Name = "FilterName"
storeParms(0).Value = "Text - txt - csv (StarCalc)"
REM See name of your filter vs Listing 5.45: Enumerate all supported filter names.
storeParms(1).Name = "FilterOptions"
storeParms(1).Value = "44,34,76,1,,0,true,true,true"
REM About this string see 12.4.6.Loading and saving documents in "OOME_3_0"
storeParms(2).Name = "Overwrite"
storeParms(2).Value = True
REM Activate sheet for export - select "VAT 48"
thisComponent.getCurrentController().setActiveSheet(thisComponent.getSheets().getByName(sSheetName))
REM storeToURL can raises com.sun.star.io.IOException! Only now:
On Error GoTo Errorhandle
REM Export
thisComponent.storeToURL(FileN,storeParms())
MsgBox ("No Error Found,Upload file is saved : """ + ConvertFromUrl(FileN) + """.")
Exit Sub
REM Do not thank me, thank Mr. Pitonyak. You can do it right here. He reads this forum.
Errorhandle:
MsgBox ("Modifications Are Not Saved,Upload File Not Generated" & chr(13) _
& "May be table " & ConvertFromUrl(FileN) & " is open in another window?")
Exit Sub
Resume
End Sub
Code: Select all
GlobalScope.BasicLibraries.LoadLibrary("Tools") ' Only for GetFileName