Vba code of saving a taxt file not working in libre office

Sub Build()
Dim yaml as string

yaml = "FieldMapping.Config:" & vbCrLf & yaml
    
    Dim vFile As Variant
    
    vFile =
Application.GetSaveAsFilename(InitialFileName:=Sheets("SIMPLE").Cells(2, 2)
& "_config.yaml", _
    FileFilter:="YAML Config File (*.yaml), *.xlsb, All files (*.*), *.*", _
    Title:="Save Config File As:")
    
    If vFile <> False Then
        Call saveFile(vFile, yaml)
        MsgBox ("File Saved")
        
    End If
  
End Sub

Sub saveFile(fileName As Variant, content As String)

    Dim fso As Object
            
    Set fso = CreateObject("Scripting.FileSystemObject")
            
    Dim oFile As Object
            
    Set oFile = fso.CreateTextFile(fileName)
            
    oFile.WriteLine content
$1.Close(False)
            
    Set fso = Nothing
    Set oFile = Nothing

End Sub

Hi,

VBA is not really supported in LibO. Try Basic/Python/etc.
Others might help more on these topics is needed....

Liebe Grüße, / Yours,
Florian Reisinger

Hi :slight_smile:
There is a guide to writing macros
https://wiki.documentfoundation.org/Documentation/Other_Documentation_and_Resources#Programmers

The usual language is another form of Basic so re-writing it is probably
not as huge a task as it might have sounded. There are soemtimes people on
this mailing list who are happy to help with short snippets.

LibreOffice also makes it fairly easy to write Add-ons/Plug-ins/Extensions
(we call them Extensions) which has some advantages.
Regards from
Tom :slight_smile: