OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

A simple macro and a stupid newbie

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Mike
Guest





PostPosted: Tue Oct 28, 2003 1:28 am    Post subject: A simple macro and a stupid newbie Reply with quote

I tried to make a macro with the macro recorder that insert tha actual date in this format "day month year". The problem is that when i try to run it i get a number (37992,43 for 28 ottobre 2003). This field code is recognized as a date (edit -> fields) but it is displayed in a way I don't want. How I can solve the problem?
The code generated is this:

sub data
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(5) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Type"
args1(0).Value = 0
args1(1).Name = "SubType"
args1(1).Value = 0
args1(2).Name = "Name"
args1(2).Value = ""
args1(3).Name = "Content"
args1(3).Value = "0"
args1(4).Name = "Format"
args1(4).Value = 5076
args1(5).Name = "Separator"
args1(5).Value = " "

dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args1())


end sub



Thanks, Mike[/code]
Back to top
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Tue Oct 28, 2003 5:12 am    Post subject: Reply with quote

As far as I know you can't. This has been a bug for some time and I just tried it again in OO1.1 final with the same results as your getting.

Here's a work around that seems to work fine. Insert your date with the desired format. Select the date field and use Edit > AutoText to set it up.


Last edited by JohnV on Tue Oct 28, 2003 4:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
Mike
Guest





PostPosted: Tue Oct 28, 2003 8:46 am    Post subject: Reply with quote

Thanks. I'll try it.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group