Ask Your Question

Macro to create fixed(!) serial IDs [closed]

asked 2012-08-15 21:32:50 +0100

wolfgang gravatar image

updated 2015-10-26 19:50:45 +0100

Alex Kemp gravatar image

For writing a requirement specification document (using writer 3.5) I would like to assign each requirement a fixed serial ID such as R0223, R0224 etc.

It is important to avoid any automatic update of that ID (for example by inserting a new requirement before an existing one) since other external documents refer to that ID. So obviously it does not make sense to use any field variables (e.g. number range) or numbering styles.

I don't know much about macros, but to me it sounds like this would be the right way to implement this function. My naive idea (algorithm?) was as follows:

  1. Add a custom property called "Counter" (File->Properties->Custom Properties->Add) with type Number and initiate it with the serial ID start number (e.g. 223).
  2. When a new requirement ID is needed the macro simply inserts the custom property field of Counter in the document (as I would do it manually via Insert->Fields->Other->DocInformation->Custom).
  3. Next, the macro cuts the inserted field and uses paste special to insert it as unformatted text so that the value is fixed.
  4. Finally, the macro increases the value of the custom property "Counter" by 1.

Sounds easy, but recording a macro like this did not work simply because any change to a custom property value is not recorded. So I created my own macro source code using the famous copy & paste and trial & error technique. I reached a point where I could output the custom properties but here my mental capabilities stop.

Does anyone have an idea why recording a macro ignores changes of a custom property value or is there a chance to get a source code examples?

Thanks a lot in advance!

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-10-26 19:51:03.730388


It would be much easier to search for a solution if you could provide your macro code.

tohuwawohu gravatar imagetohuwawohu ( 2012-08-16 11:08:49 +0100 )edit

Unfortunately uploading an attachment requires karma > 3. Anyway, that macro only contained recorded actions for the above step 2 (inserting a field) and 3 (converting field to unformatted text). Any support for creating a macro that increases the value of a custom property field would be great.

wolfgang gravatar imagewolfgang ( 2012-08-17 12:28:48 +0100 )edit

1 Answer

Sort by » oldest newest most voted

answered 2013-03-12 00:46:37 +0100

qubit gravatar image

Hi @wolfgang,

Any support for creating a macro that increases the value of a custom property field would be great.

Have you found an Answer to your question?

edit flag offensive delete link more



... If not found then read chapter "5.18.3. Master Fields" of "Useful Macro Information For By Andrew Pitonyak" (routines posted by Rodrigo V Nunes - Listing 5.50: Setting document variables.)

JohnSUN gravatar imageJohnSUN ( 2013-03-12 08:18:38 +0100 )edit

Question Tools

1 follower


Asked: 2012-08-15 21:32:50 +0100

Seen: 637 times

Last updated: Mar 12 '13