How to suppress "Import Lotus file - Character set" dialog

Is it possible to programmatically suppress, dismiss, or accept the Import Lotus file dialog box that asks for the Character set when opening a Lotus document?

I have a user with decades of old Lotus (*.123) files that need to be converted to Excel. I am able to successfully open and save the files as needed with a macro, but that dialog box appears for each file that opens.

As there are decades of files, with each year containing daily, weekly, and monthly summaries, this adds up to thousands of documents. So that dialog box is rather inconvenient.

This is the code used to open the files:

Prop(0).name = "FilterName"
Prop(0).value = "Lotus:3"
oDoc = StarDesktop.loadComponentFromURL(FileNameURL, "_blank", 0, Prop())

I have experience with Visual Basic for Applications, but I am new to LibreOffice and admittedly do not have a good grasp of the object model yet. My web searches located many comments from those wanting to suppress a similar dialog when opening CSV files, and I assume this is related. But I was not able to find a solution.

Is it possible to do this? Even with something as inelegant as a SendKeys equivalent to press the OK button?

Thanks

Could you upload a test file since not everyone has Lotus 1-2-3 installed? :slightly_smiling_face:

I don’t have it either! :slight_smile: Let me see if I am permitted to upload one of them. Thanks

The forum will not allow me to upload a *.123 file.

01.doc (90.5 KB)

I changed the extension of this file to .doc, but if you just change it back to .123 it is, in fact a Lotus 1-2-3 file.

I appreciate the assistance!

Try this way:

Sub Test
  Dim Prop(1) As New com.sun.star.beans.PropertyValue
  Dim FileNameURL As String
  Prop(0).name = "FilterName"
  Prop(0).value = "Lotus"
  Prop(1).name = "FilterOptions"
  Prop(1).value = "IBMPC_437"
  
  FileNameURL=ConvertToUrl("C:\Temp\01.123")
  oDoc = StarDesktop.loadComponentFromURL(FileNameURL, "_blank", 0, Prop())
End Sub

That’s it! Thank you very much.

I can’t believe I didn’t run across the FilterOptions property in my search. I have much to learn …

I have been working closely with Excel VBA since 1997, with LibreOffice since 2020. Recently I began to understand something in LO Calc… :slightly_smiling_face:


I found a message from @Ratslinger about this topic.

About Filter Names and Filter Options see here.

After having worked with VBA for a similar period of time, on my second day of LO development I definitely understand what you mean.