How to open a Writer document not visible in Writer basic?

How use this

oDoc = stardesktop.LoadComponentFromURL(sUrl, “_blank”, 0, Array())

make it not visible?

Try:

Dim opt(0) As com.sun.star.beans.PropertyValue

url = "private:factory/swriter"
opt(0).Name = "Hidden"
opt(0).Value = True
doc = StarDesktop.LoadComponentFromURL(url, "_blank", 0, opt)
MsgBox doc.Title
doc.close(True)

In Writer Basic I got 'Unknown Data Type com.sun.star.beans.PropertyValue ?

Show all your code, you are doing something wrong.

I tried

Dim opt(0) As New com.sun.star.beans.PropertyValue

and it works.

What OS and Libo version?

Libo version 7.3.1.3 (x64)
OS Windows 11

ok, I test in your OS…

Windows:

Dim opt(0) As New com.sun.star.beans.PropertyValue

Linux

Dim opt(0) As com.sun.star.beans.PropertyValue

or

Dim opt(0) As New com.sun.star.beans.PropertyValue

I can’t confirm it on Linux (Ubuntu 20.04 with LibreOffice 7.3.0.3 from PPA). The proper syntax is use of New when not in compatible mode (which is likely the relevant difference in your testing, not the OS).

I confirm… In Ubuntu need New, not in my system (ArchLinux, Libo 7.3.1.3), not, I do not have it in “compatible mode”