Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index

When I start LO, I want it to autoload the first document in the Recent
Documents list. I have found no option to do this in LO itself, so I
tried to cobble together an LO Basic macro attached to application start
that does that. I googled and found a couple of posts that deal with
similar problems, so I tried to adapt those (mostly this post from 2008: .)

The resulting macro attaches and is executed but it doesn't work. Now I
know almost nothing about LO (I'm a pretty new user), let alone its
macro language, but I'm a longstanding user of MS Office products and I
know their macro language fairly well.

This is my code:

Option Explicit
Sub Load1st()
Dim oCP, oCUA, oList, oItem As Object
Dim aProps(0) As New
        oCP = GetProcessServiceManager().createInstanceWithContext( _
    "", GetDefaultContext() )
        aProps(0).Name = "nodepath"
        aProps(0).Value = "/org.openoffice.Office.Common/History"
        oCUA = oCP.createInstanceWithArguments( _
    "", aProps )
        oList = oCUA.getPropertyValue( "PickList" )
        If oList.hasByName( "p0" ) Then
                oItem = oList.getByName( "p0" )
                If FileExists( oItem.URL ) Then
                        starDeskTop.loadComponentFromUrl(oItem.URL, "_blank", 0, Array())
                End If
        End If
End Sub

The macro borks at the access "oList.hasByName" which is not valid:
oList is an object so *something* does work but there's no hasByName

Anyone got an idea?


To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.