To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=70167
Issue #|70167
Summary|Macro bug for Date and other fields
Component|Word processor
Version|OOo 2.0.3
Platform|PC
URL|
OS/Version|Windows XP
Status|UNCONFIRMED
Status whiteboard|
Keywords|
Resolution|
Issue type|DEFECT
Priority|P1
Subcomponent|code
Assigned to|mru
Reported by|steveh_66
------- Additional comments from [EMAIL PROTECTED] Fri Oct 6 13:06:38 -0700
2006 -------
OK, I think that this date and time in a macro thing is a bug. Here is what I do
to make the macro:
I click on tools > macro > record macro
I click on the toolbar button to center my text
I click on insert > fields > other, and then I select the type of date that I
want, leaving it set as fixed
I close the fields box, which is what was opened up to select the type of date I
want
I put in 5 tabs
I click on insert > fields > other, and then I select the type of time that I
want, leaving it set as fixed
I close the fields box
I hit enter twice to give me a blank line and put the cursor on a second line
I click on the left justify button on the toolbar, to left justify my text
I click on stop recording macro and name my macro
OK. In past versions of Open Office, this worked great when done exactly as I
described above. (The following examples just aren't formatting the way I use
them). Any time I opened up a new document, I could run this macro and get the
date and time in the format I wanted, for example:
Fri, October 06, 2006 6:55 PM
When I first record the macro in ver. 2.0.3, it works great in the document I
recorded it in. Can use it repeatedly and it works. Can save the document and
open it later, and it works fine. But in a new document it puts in the raw data
like:
38995.79 38995.79
It also does this in a document that I create the macro in and use the macro in
(and it works great in the document as long as it is in Open Office Writer
format) but if I use 'save as' and save the document in another format such as
.rtf then it doesn't work - again it puts the data in raw format.
Now I HAVE found a workaround:
You use the macro in a new document. It puts the data in as raw data, but spaced
and everything the way you wanted it. You select one of the fields and right
click, and on the pop-up menu that comes up you select fields, and go back and
reselect the date in the format you want and click on OK. At this point, it
doesn't change it back, it stays as the raw data format. Then, you click on view
> field names. Now, the fields go to this format :
Date (fixed) Time (fixed)
OK. Now, you go back and click on view > field names (which deselects viewing as
field names) again, and after you do this it changes back, but instead of the
raw data format you get the date in the format you want and the time in the
format you want, spaced and laid out the way you wanted it to.
Of course this is a lot of steps to go through in a document where you might
only want to use the date and time once. Better to just Insert the data and
insert the time, laying it out in whatever arrangement you want to have it in
manually. Lot less work and a lot less steps. I tried doing the macro in a blank
new document, erase everything and then save that document as the default
document. But this doesn't work as a work-around, you get the raw data and have
to go through the work-around I described above. The following is the macro text
you get when you click on edit in the macro window :
Begin Macro Code
---------------------------------------------------------------------
REM ***** BASIC *****
Sub Main
End Sub
sub DateTime
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 = "CenterPara"
args1(0).Value = true
dispatcher.executeDispatch(document, ".uno:CenterPara", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(5) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Type"
args2(0).Value = 0
args2(1).Name = "SubType"
args2(1).Value = 0
args2(2).Name = "Name"
args2(2).Value = ""
args2(3).Name = "Content"
args2(3).Value = "0"
args2(4).Name = "Format"
args2(4).Value = 5078
args2(5).Name = "Separator"
args2(5).Value = " "
dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Text"
args3(0).Value = CHR$(9)+CHR$(9)+CHR$(9)+CHR$(9)+CHR$(9)
dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args3())
rem ----------------------------------------------------------------------
dim args4(5) as new com.sun.star.beans.PropertyValue
args4(0).Name = "Type"
args4(0).Value = 1
args4(1).Name = "SubType"
args4(1).Value = 0
args4(2).Name = "Name"
args4(2).Value = ""
args4(3).Name = "Content"
args4(3).Value = "0"
args4(4).Name = "Format"
args4(4).Value = 5042
args4(5).Name = "Separator"
args4(5).Value = " "
dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args4())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())
rem ----------------------------------------------------------------------
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "LeftPara"
args7(0).Value = true
dispatcher.executeDispatch(document, ".uno:LeftPara", "", 0, args7())
end sub
End Macro Code
----------------------------------------------------------------------------
I researched through the forums and couldn't find a way to fix this. I found a
lot of posts where people said download my macros and use them. Or showed their
macro code in the post itself
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]