[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libreoffice-users] Date format macro.
[Thread Prev] | [Thread Next]
- Subject: Re: [libreoffice-users] Date format macro.
- From: rhubarbpieguy@gmail.com
- Date: Fri, 20 Jul 2012 20:33:27 -0500
- To: users@global.libreoffice.org
On 07/20/12 02:16, Dave Barton wrote:
-------- Original Message --------Thank you for responding; I admire your style. I manually changed the date format of my spreadsheet, saved , then coded it as the default template. The default template took, but unfortunately, again the user-defined date format wasn't saved.
From: rhubarbpieguy@gmail.com
To: users@global.libreoffice.org
Date: Thu, 19 Jul 2012 16:48:53 -0500
I'd like to create a macro for a user-defined date format (H:MMa/p). AsSorry I can't help with your macro, but I like your idea.
examples, 7:00 AM would display as 7:00a and 3:33 PM as 3:33p. I can
create the format manually, but I understand the LibreOffice format
can't save user-defined formats. So my thought is to create a macro
which creates the format each time the spreadsheet is opened. The
user-defined Format Code is for a saved Style.
The macro records without incident and the date format is correct.
However, running the saved macro doesn't change the format. It seems
this should work. Thoughts? The recorded macro is as follows:
sub FormatTime
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$D$13"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "DesignerDialog"
args2(0).Value = true
dispatcher.executeDispatch(document, ".uno:DesignerDialog", "", 0, args2())
rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:EditStyle", "", 0, Array())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "DesignerDialog"
args4(0).Value = false
dispatcher.executeDispatch(document, ".uno:DesignerDialog", "", 0, args4())
end sub
An alternative approach I use, is to add my user defined date format to
my Calc default template.
Dave
Do I understand you can save a user-defined date format in the default template and it takes? I'm sure a macro would work and I can wade through the code, but if there's an easier way I'm interested.
--
For unsubscribe instructions e-mail to: users+help@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
| [libreoffice-users] Re: Date format macro. | Andreas Säger <villeroy@t-online.de> |
| Re: [libreoffice-users] Date format macro. | Dave Barton <db@tasit.net> |
| [libreoffice-users] Date format macro. | rhubarbpieguy@gmail.com |
| Re: [libreoffice-users] Date format macro. | Dave Barton <db@tasit.net> |
- Prev by Date: [libreoffice-users] Re: LO for a Mac Powerbook G4
- Next by Date: [libreoffice-users] Re: Date format macro.
- Previous by thread: Re: [libreoffice-users] Date format macro.
- Next by thread: Re: [libreoffice-users] Date format macro.
- Index(es):
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 GNU Lesser General Public License (LGPLv3). "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.