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


Monologuing 1/2...

I can't believe I am the only guy on this weird planet who wants this
feature. Come on, somebody must have done this before!?

But even if not, there surely must be a way to do that via a LO Basic
macro. In MS Word and Excel (if I'm allowed to mention these here) it's
so easy to hack this together, even for a relative novice, that I'm
amazed LO is making it so darned difficult.

(And please, no comments along the lines that I should just go back to
MS... I am honestly trying to get away from MS Office.)

Jon

----original message----
From: Jon Harringdon <jonathan.harringdon@virgin.net>
Date: Fri, 11 Jul 2014 15:39:54 +0100
Subj: [libreoffice-users] Macro to autoload first recent doc
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:
https://forum.openoffice.org/en/forum/viewtopic.php?t=7128 .)

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 com.sun.star.beans.PropertyValue
      oCP = GetProcessServiceManager().createInstanceWithContext( _
    "com.sun.star.configuration.ConfigurationProvider", GetDefaultContext() )
      aProps(0).Name = "nodepath"
      aProps(0).Value = "/org.openoffice.Office.Common/History"
      oCUA = oCP.createInstanceWithArguments( _
    "com.sun.star.configuration.ConfigurationUpdateAccess", 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
item.

Anyone got an idea?

Jon

-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


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.