Spreadsheet is not getting saved as new file when save as dialog is called from macro

Hi guys,

I am triggering a save as dialog box from a macro in order to save a file as shown in the code below.

    dim oFilePicker 
dim docPath as String
dim sFilePickerArgs(0) as Integer

sFilePickerArgs(0) = 10
oFilePicker = CreateUnoService( "com.sun.star.ui.dialogs.FilePicker" )
docPath = Tools.Strings.DirectoryNameoutofPath(ThisComponent.getURL(), "/")
With oFilePicker
  .Initialize( sFilePickerArgs() )
  .setDisplayDirectory( docPath )
  .appendFilter("ODF Spreadsheet (.ods)", "*.ods" )
  .setTitle( "Save As ..." )
End With

If oFilePicker.execute() = 1 Then
	rem some code
End If

However the file is not getting saved as a new file as it does when clicking save as in the file menu. That is nothing happens. I am not sure what I am doing wrong here and I have been stuck with this for 2 days. It is very likely that I am making some careless error, or that I have missed out something very obvious. But I have been searching for a solution online for hours and I have no clue what is going wrong

I am using LO 6.3 on mac os 10.13.6.

It work as it is expectable: Because there is not any StoreAsUrl() or StoreToUrl() command in your code. The File Picker feature is only for selecting/getting path and file name. It has not any saving procedure by default. (It is not a full featured “Save as” form.) You must write the saving procedure.
A similar topic:

Or you can call the predefined Save as UNO feature.

Thanks @Zizi64. I understood it from the links you have shared.