-
Notifications
You must be signed in to change notification settings - Fork 4
/
GS6013-GettingStartedWithMacros.xlf
3316 lines (3316 loc) · 265 KB
/
GS6013-GettingStartedWithMacros.xlf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version='1.0' encoding='UTF-8'?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.1" version="1.1">
<file original="GS6013-GettingStartedWithMacros.odt" source-language="en" datatype="plaintext">
<body>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[1]">
<source><x id="0" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[1]/draw:frame[0]"/>Getting Started Guide</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[2]">
<source>Chapter 13 <g id="1"/><g id="2"/>Getting Started with Macros</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[3]">
<source>Using the Macro Recorder … and Beyond</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[0]">
<source><x id="3" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[0]/text:bookmark-start[0]"/>Copyright<x id="4" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[0]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:p[0]">
<source>This document is Copyright © 2017 by the LibreOffice Documentation Team. Contributors are listed below. You may distribute it and/or modify it under the terms of either the GNU General Public License (<g id="5">http://www.gnu.org/licenses/gpl.html</g>), version 3 or later, or the Creative Commons Attribution License (<g id="6">http://creativecommons.org/licenses/by/4.0/</g>), version 4.0 or later.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:p[1]">
<source>All trademarks within this guide belong to their legitimate owners.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[1]">
<source><x id="7" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[1]/text:bookmark-start[0]"/>Contributors<x id="8" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[1]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[0]/table:table-row[0]/table:table-cell[0]/text:p[0]">
<source>Andrew Pitonyak </source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[0]/table:table-row[0]/table:table-cell[1]/text:p[0]">
<source>Peter Schofield</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[0]/table:table-row[0]/table:table-cell[2]/text:p[0]">
<source>Martin Fox</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[0]/table:table-row[1]/table:table-cell[0]/text:p[0]">
<source>Ron Faile Jr.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[0]/table:table-row[1]/table:table-cell[1]/text:p[0]">
<source>Hazel Russman</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[0]/table:table-row[1]/table:table-cell[2]/text:p[0]">
<source>Olivier Hallot</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[0]/table:table-row[2]/table:table-cell[0]/text:p[0]">
<source>Valerii Goncharuk</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[0]/table:table-row[2]/table:table-cell[1]/text:p[0]">
<source>Andrew Jensen</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[2]">
<source><x id="9" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[2]/text:bookmark-start[0]"/>Feedback<x id="10" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[2]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:p[2]">
<source>Please direct any comments or suggestions about this document to the Documentation Team’s mailing list: <g id="11">documentation@global.libreoffice.org</g></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:list[0]/text:list-item[0]/text:p[0]">
<source>Note</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:p[3]">
<source>Everything you send to a mailing list, including your email address and any other personal information that is written in the message, is publicly archived and cannot be deleted.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[3]">
<source><x id="12" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[3]/text:bookmark-start[0]"/>Acknowledgments<x id="13" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[3]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:p[4]">
<source>This chapter is based on Chapter 13 of <g id="14">Getting Started with OpenOffice.org 3.3</g>. The contributors to that chapter are:</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[1]/table:table-row[0]/table:table-cell[0]/text:p[0]">
<source><x id="15" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[1]/table:table-row[0]/table:table-cell[0]/text:p[0]/text:bookmark-start[0]"/>Andrew Pitonyak<x id="16" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[1]/table:table-row[0]/table:table-cell[0]/text:p[0]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[1]/table:table-row[0]/table:table-cell[1]/text:p[0]">
<source>Jean Hollis Weber</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[4]">
<source><x id="17" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[4]/text:bookmark-start[0]"/>Publication date and software version<x id="18" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[4]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:p[5]">
<source>Published <g id="19"/>01 June 2018. Based on LibreOffice 6.0.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[5]">
<source><x id="20" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[5]/text:bookmark-start[0]"/>Note for <g id="21">m</g>ac<g id="22">OS</g> users<x id="23" xid="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:h[5]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:p[6]">
<source>Some keystrokes and menu items are different on <g id="24">m</g>ac<g id="25">OS</g> from those used in Windows and Linux. The table below gives some common substitutions for the instructions in this chapter. For a more detailed list, see the application Help.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[0]/table:table-cell[0]/text:p[0]">
<source>Windows or Linux</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[0]/table:table-cell[1]/text:p[0]">
<source>Mac<g id="26">OS</g> equivalent</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[0]/table:table-cell[2]/text:p[0]">
<source>Effect</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[1]/table:table-cell[0]/text:p[0]">
<source><g id="27">Tools > Options</g> menu selection</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[1]/table:table-cell[1]/text:p[0]/text:span[0]">
<source>LibreOffice > Preferences</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[1]/table:table-cell[2]/text:p[0]">
<source>Access setup options</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[2]/table:table-cell[0]/text:p[0]/text:span[0]">
<source>Right-click</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[2]/table:table-cell[1]/text:p[0]">
<source>Control+click and/or right-click depending on computer setup</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[2]/table:table-cell[2]/text:p[0]">
<source>Open a context menu</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[3]/table:table-cell[0]/text:p[0]">
<source><g id="28">Ctrl</g> (<g id="29">Control</g>)</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[3]/table:table-cell[1]/text:p[0]">
<source>⌘ (<g id="30">Command</g>)</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[3]/table:table-cell[2]/text:p[0]">
<source>Used with other keys</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[4]/table:table-cell[0]/text:p[0]/text:span[0]">
<source>F5</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[4]/table:table-cell[1]/text:p[0]">
<source><g id="31">Shift</g>+⌘+<g id="32">F5</g></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[4]/table:table-cell[2]/text:p[0]">
<source>Open the Navigator</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[5]/table:table-cell[0]/text:p[0]/text:span[0]">
<source>F11</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[5]/table:table-cell[1]/text:p[0]">
<source>⌘+<g id="33">T</g></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/table:table[2]/table:table-row[5]/table:table-cell[2]/text:p[0]">
<source>Open the <g id="34">sidebar </g>Styles <g id="35">deck</g></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:index-title[0]/text:p[0]">
<source>Contents</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[0]/text:a[0]">
<source>Copyright<g id="36"/>2</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[1]/text:a[0]">
<source>Contributors<g id="37"/>2</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[2]/text:a[0]">
<source>Feedback<g id="38"/>2</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[3]/text:a[0]">
<source>Acknowledgments<g id="39"/>2</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[4]/text:a[0]">
<source>Publication date and software version<g id="40"/>2</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[5]/text:a[0]">
<source>Note for macOS users<g id="41"/>2</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[6]/text:a[0]">
<source>Introduction<g id="42"/>4</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[7]/text:a[0]">
<source>Your first macros<g id="43"/>4</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[8]/text:a[0]">
<source>Adding a macro<g id="44"/>4</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[9]/text:a[0]">
<source>Recording a macro<g id="45"/>6</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[10]/text:a[0]">
<source>Running a macro<g id="46"/>7</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[11]/text:a[0]">
<source>Viewing and editing macros<g id="47"/>7</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[12]/text:a[0]">
<source>Commenting with REM<g id="48"/>8</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[13]/text:a[0]">
<source>Defining subroutines with SUB<g id="49"/>8</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[14]/text:a[0]">
<source>Defining variables using Dim<g id="50"/>9</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[15]/text:a[0]">
<source>Explaining macro code<g id="51"/>9</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[16]/text:a[0]">
<source>Creating a macro<g id="52"/>10</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[17]/text:a[0]">
<source>A more complicated example of a macro<g id="53"/>10</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[18]/text:a[0]">
<source>Running a macro quickly<g id="54"/>13</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[19]/text:a[0]">
<source>Macro recorder failures<g id="55"/>14</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[20]/text:a[0]">
<source>Dispatch framework<g id="56"/>14</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[21]/text:a[0]">
<source>How the macro recorder uses the dispatch framework<g id="57"/>14</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[22]/text:a[0]">
<source>Other options<g id="58"/>14</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[23]/text:a[0]">
<source>Macro organization<g id="59"/>15</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[24]/text:a[0]">
<source>Where are macros stored?<g id="60"/>16</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[25]/text:a[0]">
<source>Importing macros<g id="61"/>16</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[26]/text:a[0]">
<source>Downloading macros to import<g id="62"/>18</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[27]/text:a[0]">
<source>How to run a macro<g id="63"/>18</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[28]/text:a[0]">
<source>Toolbars, menu items, and keyboard shortcuts<g id="64"/>19</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[29]/text:a[0]">
<source>Events<g id="65"/>19</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[30]/text:a[0]">
<source>Extensions<g id="66"/>20</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[31]/text:a[0]">
<source>Writing macros without the recorder<g id="67"/>21</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[32]/text:a[0]">
<source>Finding more information<g id="68"/>21</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[33]/text:a[0]">
<source>Included material<g id="69"/>21</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[34]/text:a[0]">
<source>Online resources<g id="70"/>22</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:section[0]/text:table-of-content[0]/text:index-body[0]/text:p[35]/text:a[0]">
<source>Printed and eBook materials<g id="71"/>22</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:h[0]">
<source><x id="72" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[0]/text:bookmark-start[0]"/>Introduction<x id="73" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[0]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[4]">
<source>A macro is a saved sequence of commands that are stored for later use. An example of a simple macro is one that “types” your address. The LibreOffice macro language is very flexible, allowing automation of both simple and complex tasks. Macros are very useful when you have to repeat the same task in the same way over and over again.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[5]">
<source>LibreOffice macros are usually written in a language called <x id="74" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[5]/text:alphabetical-index-mark[0]"/>LibreOffice Basic, sometimes abbreviated to <x id="75" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[5]/text:alphabetical-index-mark-start[0]"/>Basic<x id="76" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[5]/text:alphabetical-index-mark-end[0]"/>. Although you can learn Basic and write macros, there is a steep learning curve to writing macros from scratch. The usual methods for a beginner are to use macros that someone else has written or use the built-in macro recorder, which records keystrokes and saves them for use.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[6]">
<source>Most tasks in LibreOffice are accomplished by “dispatching a command” (sending a command), which is intercepted and used. The macro recorder works by recording the commands that are dispatched (see “<g id="77"><x id="78" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[6]/text:span[0]"/></g>” <g id="79">on page </g><g id="80"><x id="81" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[6]/text:span[2]"/></g>).</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:h[1]">
<source><x id="82" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[1]/text:bookmark-start[0]"/>Your first <x id="83" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[1]/text:alphabetical-index-mark[0]"/>macros<x id="84" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[1]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:h[2]">
<source><x id="85" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[2]/text:bookmark-start[0]"/>Adding a macro<x id="86" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[2]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[7]">
<source>The first step in learning macro programming is to find and <x id="87" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[7]/text:alphabetical-index-mark[0]"/>use existing macros. This section assumes that you have a macro that you want to use, which may be in an email, on a web page, or even in a book. For this example, the macro in Listing <x id="88" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[7]"/><g id="89"/>is used. You should create a library and module to contain your macro; see “<x id="90" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[7]"/>” on page <x id="91" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[7]"/><g id="92"/>for more information.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[8]">
<source>Listing <x id="93" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[8]"/>: Simple macro that says hello</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[10]/text:span[0]">
<source>Sub</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[10]/text:span[1]">
<source>HelloMacro</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[11]/text:span[1]">
<source>Print</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[11]/text:span[2]">
<source>"Hello"</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[12]/text:span[0]">
<source>End</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[12]/text:span[1]">
<source> S</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[12]/text:span[2]">
<source>ub</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[13]">
<source>Use the following steps to create a library which will contain your macro:</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[0]/text:p[0]">
<source>Go to <g id="94">Tools > Macros > Organize Macros > LibreOffice Basic</g> to open the LibreOffice Basic Macros dialog (Figure <x id="95" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[0]/text:p[0]"/>).</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[1]/text:p[0]">
<source>Click <g id="96">Organizer</g> to open the Basic Macro Organizer dialog (Figure <x id="97" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[1]/text:p[0]"/>) and select the <g id="98">Libraries</g> tab.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[2]/text:p[0]">
<source>Set the <g id="99">Location</g> to <g id="100">My Macros & Dialogs</g>, which is the default location.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[3]/text:p[0]">
<source>Click <g id="101">New</g> to open the New Library dialog.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[4]/text:p[0]">
<source>Enter a library name, for example TestLibrary, and click <g id="102">OK</g>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[5]/text:p[0]">
<source>Select the <g id="103">Modules</g> tab.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[6]/text:p[0]">
<source>In the <g id="104">Module</g> list, expand <g id="105">My Macros</g> and select your librery (in the example TestLibrary). A module named Module1 already exists and can contain your macro. If you wish, you can click <g id="106">New</g> to create another module in the library.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[7]/text:p[0]">
<source>Select Module1, or the new module that you created, and click <g id="107">Edit</g> to open the Integrated Development Environment (IDE) (Figure <x id="108" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[7]/text:p[0]"/>). The IDE is a text editor included with LibreOffice that allows you to create and edit macros.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[8]/text:p[0]">
<source>When a new module is created, it contains a comment and an empty macro named Main, which does nothing.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[9]/text:p[0]">
<source>Add the new macro either before Sub Main or after End Sub. Listing <x id="109" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[0]/text:list-item[9]/text:p[0]"/><g id="110"/>shows the new macro has been added before Sub Main.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[15]/text:span[0]/draw:frame[0]/draw:text-box[0]/text:p[1]">
<source><x id="111" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[15]/text:span[0]/draw:frame[0]/draw:text-box[0]/text:p[1]/draw:frame[0]"/>Figure <x id="112" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[15]/text:span[0]/draw:frame[0]/draw:text-box[0]/text:p[1]"/>: LibreOffice Basic Macros dialog</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[16]/text:span[0]/draw:frame[0]/draw:text-box[0]/text:p[0]">
<source><x id="113" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[16]/text:span[0]/draw:frame[0]/draw:text-box[0]/text:p[0]/draw:frame[0]"/>Figure <x id="114" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[16]/text:span[0]/draw:frame[0]/draw:text-box[0]/text:p[0]"/>: LibreOffice Basic Macro Organizer dialog</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[1]/text:list-item[0]/text:p[0]">
<source>Click the <g id="115">Compile</g> icon <g id="116"><x id="117" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[1]/text:list-item[0]/text:p[0]/text:span[1]/draw:frame[0]"/></g><g id="118"/>on the Macro toolbar to compile the macro.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[1]/text:list-item[1]/text:p[0]">
<source>Place the cursor in the HelloMacro subroutine and click the <g id="119">Run BASIC</g> icon <x id="120" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[1]/text:list-item[1]/text:p[0]/draw:frame[0]"/><g id="121"/>on the Macro toolbar, or press the <g id="122">F5</g> key, to run the HelloMacro in the module. A small dialog will open with the word “Hello” displayed. If the cursor is not in a subroutine or function, a dialog will open; select the macro to run.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[1]/text:list-item[2]/text:p[0]">
<source>Click <g id="123">OK</g> to close this small dialog.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[1]/text:list-item[3]/text:p[0]">
<source>To select and run any macro in the module, click the <g id="124">Select Macro </g>icon <x id="125" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[1]/text:list-item[3]/text:p[0]/draw:frame[0]"/><g id="126"/>on the Standard toolbar or go to <g id="127">Tools > Organize Macros > LibreOffice Basic</g>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[1]/text:list-item[4]/text:p[0]">
<source>Select a macro and then click <g id="128">Run</g>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[17]/text:span[0]/text:span[0]/draw:frame[0]/draw:text-box[0]/text:p[0]">
<source><x id="129" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[17]/text:span[0]/text:span[0]/draw:frame[0]/draw:text-box[0]/text:p[0]/draw:frame[0]"/>Figure <x id="130" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[17]/text:span[0]/text:span[0]/draw:frame[0]/draw:text-box[0]/text:p[0]"/>: Integrated Development Environment <g id="131">window</g></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[18]">
<source>Listing <x id="132" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[18]"/>: Module1 after adding the new macro.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[20]/text:span[0]/text:span[0]">
<source>REM <g id="133"/>***** <g id="134"/>BASIC <g id="135"/>*****</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[22]/text:span[0]">
<source>Sub</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[22]/text:span[1]">
<source>HelloMacro</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[23]/text:span[1]">
<source>Print</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[23]/text:span[2]">
<source>"Hello"</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[24]/text:span[0]">
<source>End</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[24]/text:span[1]">
<source> S</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[24]/text:span[2]">
<source>ub</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[26]/text:span[0]">
<source>Sub</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[26]/text:span[1]">
<source>Main</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[28]/text:span[0]">
<source>End</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[28]/text:span[2]">
<source>Sub</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:h[3]">
<source><x id="136" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[3]/text:bookmark-start[0]"/>Recording a <x id="137" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[3]/text:alphabetical-index-mark[0]"/>macro<x id="138" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[3]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[29]">
<source>If you have to repeatedly enter the same information, you can copy this information after it has been entered into your document for the first time, then paste the information into your document each time you want to use it. However, if something else is copied to the clipboard, the contents on the clipboard are changed. This means that you have to re-copy your repeated information. To overcome this problem, you can create a macro that enters your repeated information.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[2]/text:list-item[0]/text:p[0]">
<source>Note</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[30]">
<source>For some cases when you want to repeatedly use information into a document, it may be more convenient to create an AutoText. See the <g id="139">Writer Guide Chapter 2 Working with Text:Basics</g> for more information.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[31]">
<source>Make sure macro recording is enabled by going to <g id="140">Tools > Options > LibreOffice > Advanced</g> on the main menu bar and selecting the option <g id="141">Enable macro recording</g>. By default, this feature is turned off in LibreOffice.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[0]/text:p[0]">
<source>Go to <g id="142">Tools > Macros > Record Macro</g> on the main menu bar to start recording a macro. A small dialog is displayed indicating that LibreOffice is recording a macro.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[1]/text:p[0]">
<source><x id="143" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[1]/text:p[0]/text:soft-page-break[0]"/>Type the desired information or perform an appropriate series of operations. As an example, type your name.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[2]/text:p[0]">
<source>Click <g id="144">Stop Recording</g> on the small Recording dialog to stop recording <x id="145" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[2]/text:p[0]/text:alphabetical-index-mark[0]"/>and the LibreOffice Basic Macros dialog opens (Figure <x id="146" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[2]/text:p[0]"/><g id="147"/>on page <x id="148" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[2]/text:p[0]"/>).</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[3]/text:p[0]">
<source>Open <x id="149" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[3]/text:p[0]/text:alphabetical-index-mark[0]"/>the library container <g id="150">My Macros</g>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[4]/text:p[0]">
<source>Find the library named <g id="151">Standard</g> in My Macros. Note that every library container has a library named Standard.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[5]/text:p[0]">
<source>Select the Standard library and click <g id="152">New Module</g> to create a <x id="153" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[5]/text:p[0]/text:alphabetical-index-mark[0]"/>new module to contain the macro. This opens the New Module dialog.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[6]/text:p[0]">
<source>Type a descriptive name for the new module, for example <g id="154">RecordsInsertText</g>, and click <g id="155">OK</g> to create the module. The LibreOffice Basic Macros dialog now displays the name of the new module in the Standard library.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[7]/text:p[0]">
<source>In the <g id="156">Macro name</g> text box, type a name for the macro you have just recorded, for example <g id="157">EnterMyName</g>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[3]/text:list-item[8]/text:p[0]">
<source>Click <g id="158">Save</g> to save the macro and close the LibreOffice Basic Macros dialog.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[32]">
<source>If you followed all of the above steps, the Standard library now contains a module named Record<g id="159">sInsertText</g> and this module contains the EnterMyName macro.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[4]/text:list-item[0]/text:p[0]">
<source>Note</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[33]">
<source>When LibreOffice creates a new module, it automatically adds the macro named Main.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:h[4]">
<source><x id="160" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[4]/text:bookmark-start[0]"/><x id="161" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[4]/text:alphabetical-index-mark[0]"/>Running a macro<x id="162" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[4]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[5]/text:list-item[0]/text:p[0]">
<source>Go to <g id="163">Tools > Macros > Run Macro</g> on the main menu bar to open the Macro Selector dialog (Figure <x id="164" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[5]/text:list-item[0]/text:p[0]"/>).</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[5]/text:list-item[1]/text:p[0]">
<source>For example, select your newly created macro EnterMyName and click <g id="165">Run</g>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[5]/text:list-item[2]/text:p[0]">
<source>Alternatively, go to <g id="166">Tools > Macros > Organize Macros > LibreOffice Basic</g> on the main menu bar to open the LibreOffice Basic Macros dialog, select your macro and click <g id="167">Run</g>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[34]/draw:frame[0]/draw:text-box[0]/text:p[0]">
<source><x id="168" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[34]/draw:frame[0]/draw:text-box[0]/text:p[0]/draw:frame[0]"/>Figure <x id="169" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[34]/draw:frame[0]/draw:text-box[0]/text:p[0]"/>: Macro Selector dialog</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:h[5]">
<source><x id="170" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[5]/text:bookmark-start[0]"/><x id="171" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[5]/text:alphabetical-index-mark[0]"/>Viewing <x id="172" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[5]/text:alphabetical-index-mark[1]"/>and editing macros<x id="173" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[5]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[35]">
<source>To view and/or edit the macro that you created:</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[6]/text:list-item[0]/text:p[0]">
<source>Go to <g id="174">Tools > Macros > Organize Macros > LibreOffice Basic</g> to open the LibreOffice Basic Macros dialog.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[6]/text:list-item[1]/text:p[0]">
<source>Select your new macro EnterMyName and click <g id="175">Edit</g>.The Basic <x id="176" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[6]/text:list-item[1]/text:p[0]/text:alphabetical-index-mark-start[0]"/><x id="177" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[6]/text:list-item[1]/text:p[0]/text:alphabetical-index-mark-start[1]"/>IDE<x id="178" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[6]/text:list-item[1]/text:p[0]/text:alphabetical-index-mark-end[0]"/><x id="179" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[6]/text:list-item[1]/text:p[0]/text:alphabetical-index-mark-end[1]"/> will be opened andthe macro EnterMyName will be shown as in Listing <x id="180" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[6]/text:list-item[1]/text:p[0]"/>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[36]">
<source><x id="181" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[36]/text:soft-page-break[0]"/>This first macro is not complicated. A little explanation will significantly help you in understanding macros. The discussion starts with first line of the macro and describes features through whole listing.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[37]">
<source>Listing <x id="182" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[37]"/>: Generated “EnterMyname” macro</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[38]/text:span[0]">
<source>REM <g id="183"/>***** <g id="184"/>BASIC <g id="185"/>*****</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[39]/text:span[0]">
<source>Sub</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[39]/text:span[1]">
<source>Main</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[41]/text:span[0]">
<source>End</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[41]/text:span[1]">
<source>Sub</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[43]/text:span[0]">
<source>sub</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[43]/text:span[1]">
<source>EnterMyName</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[44]/text:span[0]">
<source>rem -------------------------------------------------------------</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[45]/text:span[0]">
<source>rem define variables</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[46]/text:span[0]">
<source>dim</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[46]/text:span[1]">
<source>document</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[46]/text:span[2]">
<source>as</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[46]/text:span[3]">
<source>object</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[47]/text:span[0]">
<source>dim</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[47]/text:span[1]">
<source>dispatcher</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[47]/text:span[2]">
<source>as</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[47]/text:span[3]">
<source>object</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[48]/text:span[0]">
<source>rem -------------------------------------------------------------</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[49]/text:span[0]">
<source>rem get access to the document</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[50]/text:span[0]">
<source>document</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[50]/text:span[1]">
<source>=</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[50]/text:span[2]">
<source>ThisComponent</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[50]/text:span[3]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[50]/text:span[4]">
<source>CurrentController</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[50]/text:span[5]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[50]/text:span[6]">
<source>Frame</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[51]/text:span[0]">
<source>dispatcher</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[51]/text:span[1]">
<source>=</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[51]/text:span[2]">
<source>createUnoService</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[51]/text:span[3]">
<source>(</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[51]/text:span[4]">
<source>"com.sun.star.frame.DispatchHelper"</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[51]/text:span[5]">
<source>)</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[53]/text:span[0]">
<source>rem -------------------------------------------------------------</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[0]">
<source>dim</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[1]">
<source>args1</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[2]">
<source>(</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[3]">
<source>0</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[4]">
<source>)</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[5]">
<source>as</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[6]">
<source>new</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[7]">
<source>com</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[8]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[9]">
<source>sun</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[10]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[11]">
<source>star</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[12]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[13]">
<source>beans</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[14]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[54]/text:span[15]">
<source>PropertyValue</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[55]/text:span[0]">
<source>args1</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[55]/text:span[1]">
<source>(</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[55]/text:span[2]">
<source>0</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[55]/text:span[3]">
<source>).Name</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[55]/text:span[4]">
<source>=</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[55]/text:span[5]">
<source>"Text"</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[56]/text:span[0]">
<source>args1</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[56]/text:span[1]">
<source>(</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[56]/text:span[2]">
<source>0</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[56]/text:span[3]">
<source>).</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[56]/text:span[4]">
<source>Value</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[56]/text:span[5]">
<source>=</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[56]/text:span[6]">
<source>"Your name"</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[0]">
<source>dispatcher</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[1]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[2]">
<source>executeDispatch</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[3]">
<source>(</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[4]">
<source>document</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[5]">
<source>,</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[6]">
<source>".uno:InsertText"</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[7]">
<source>,</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[8]">
<source>""</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[9]">
<source>,</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[10]">
<source>0</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[11]">
<source>,</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[12]">
<source>args1</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[58]/text:span[13]">
<source>())</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[59]/text:span[0]">
<source>end</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[59]/text:span[1]">
<source>sub</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:h[6]">
<source><x id="186" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[6]/text:bookmark-start[0]"/>Commenting with <x id="187" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[6]/text:alphabetical-index-mark-start[0]"/><x id="188" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[6]/text:alphabetical-index-mark-start[1]"/>REM<x id="189" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[6]/text:bookmark-end[0]"/><x id="190" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[6]/text:alphabetical-index-mark-end[0]"/><x id="191" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[6]/text:alphabetical-index-mark-end[1]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[60]">
<source>All comments in macro coding begin with REM, which stands for remark. All text after REM on the same line is ignored. </source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[7]/text:list-item[0]/text:p[0]">
<source>Note</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[61]">
<source>As a short cut, you can use the single quote character (') to start a comment.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[62]">
<source>LibreOffice Basic is not case-sensitive for keywords, so REM, Rem, and rem can all start a comment. If you use symbolic constants defined by the Application Programming Interface (API), it is safer to assume that the names are case-sensitive. Symbolic constants are an advanced topic not covered by this user guide and are not required when using the macro recorder in LibreOffice.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:h[7]">
<source><x id="192" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[7]/text:bookmark-start[0]"/><x id="193" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[7]/text:alphabetical-index-mark[0]"/><x id="194" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[7]/text:alphabetical-index-mark[1]"/>Defining subroutines with <x id="195" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[7]/text:alphabetical-index-mark-start[0]"/>SUB<x id="196" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[7]/text:bookmark-end[0]"/><x id="197" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[7]/text:alphabetical-index-mark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[63]">
<source>Individual macros are stored in subroutines and these subroutines begin with the keyword SUB. The end of a subroutine is indicated by the words END SUB. The code starts by defining the subroutine named Main, which is empty and does nothing. The next subroutine, EnterMyName, contains the generated code for your macro.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[8]/text:list-item[0]/text:p[0]">
<source>Note</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[64]">
<source>LibreOffice always creates an empty subroutine named Main when it creates a module.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[65]">
<source>There are advanced topics that are beyond the scope of this user guide, but knowing about them might be of interest:</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[9]/text:list-item[0]/text:p[0]">
<source>You can write a macro so that values can be passed to the subroutine. The values are called arguments. However, recorded macros in LibreOffice do not accept arguments.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[9]/text:list-item[1]/text:p[0]">
<source><x id="198" xid="office:document-content[0]/office:body[0]/office:text[0]/text:list[9]/text:list-item[1]/text:p[0]/text:soft-page-break[0]"/>Another kind of subroutine is called a function, which is a subroutine that can return a value as a result of the work. Functions are defined by the keyword FUNCTION at the beginning. Recorded macros in LibreOffice creates subroutines only.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:h[8]">
<source><x id="199" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[8]/text:bookmark-start[0]"/><x id="200" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[8]/text:alphabetical-index-mark[0]"/>Defining <x id="201" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[8]/text:alphabetical-index-mark[1]"/>variables using <x id="202" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[8]/text:alphabetical-index-mark-start[0]"/><x id="203" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[8]/text:alphabetical-index-mark-start[1]"/>Dim<x id="204" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[8]/text:bookmark-end[0]"/><x id="205" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[8]/text:alphabetical-index-mark-end[0]"/><x id="206" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[8]/text:alphabetical-index-mark-end[1]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[66]">
<source>You can write information on a piece of paper so that you can look at it later. A variable, like a piece of paper, contains information that can be changed and read. The Dim keyword originally stood for Dimension and was used to define the dimensions of an array. The dim statement used in the EnterMyName macro is similar to setting aside a piece of paper to be used to store a message or note.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[67]">
<source>In the EnterMyName macro, the variables <g id="207">document</g> and <g id="208">dispatcher</g> are defined as the type <g id="209">object</g>. Other common variable types include <g id="210">string</g>, <g id="211">integer</g>, and <g id="212">date</g>. A third variable, named <g id="213">args1</g>, is an array of property values. A variable of type <g id="214">array</g> allows a single variable to contain multiple values, similar to storing multiple pages in a single book. Values in an array are usually numbered starting from zero. The number in the parentheses indicates the highest usable number to access a storage location. In this example, there is only one value, and it is numbered zero.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:h[9]">
<source><x id="215" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[9]/text:bookmark-start[0]"/>Explaining macro code<x id="216" xid="office:document-content[0]/office:body[0]/office:text[0]/text:h[9]/text:bookmark-end[0]"/></source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[68]">
<source>The following is an explanation of the code used in the EnterMyName macro. You may not understand all the details, but the explanation of each line of code may give you some idea of how a macro works.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[69]/text:span[0]">
<source>sub</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[69]/text:span[1]">
<source>EnterMyName</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[70]">
<source>Defines the start of the EnterMyName<g id="217"> </g>macro.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[71]/text:span[0]">
<source>dim</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[71]/text:span[1]">
<source>document</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[71]/text:span[2]">
<source>as</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[71]/text:span[3]">
<source>object</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[72]">
<source>Defines document as an object variable. Objects are a specific variable type with multiple <g id="218">fields</g> (s<x id="219" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[72]/text:bookmark[0]"/>ometimes they are called <g id="220">properties</g>) and <g id="221">actions</g> (also they are called <g id="222">methods</g>). The fields can be perceived like variables (including an object) and actions like subroutines which allow us to operate with the object.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:list[10]/text:list-item[0]/text:p[0]">
<source>Note</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[73]">
<source>Sometimes the word <g id="223">service</g> is used. A service is supplied by a type of object which are distinguished in order to point out how they are used.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[74]/text:span[0]">
<source>dim</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[74]/text:span[1]">
<source>dispatcher</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[74]/text:span[2]">
<source>as</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[74]/text:span[3]">
<source>object</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[75]">
<source>Defines dispatcher as an <x id="224" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[75]/text:bookmark-start[0]"/>object<x id="225" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[75]/text:bookmark-end[0]"/> variable.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[76]/text:span[0]">
<source>document</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[76]/text:span[1]">
<source>=</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[76]/text:span[2]">
<source>ThisComponent</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[76]/text:span[3]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[76]/text:span[4]">
<source>CurrentController</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[76]/text:span[5]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[76]/text:span[6]">
<source>Frame</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[77]">
<source>ThisComponent refers to the current document.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[78]">
<source>CurrentController is a property referring to a service that controls the document. For example, when you type, it is the current controller that takes note of what you type. CurrentController then dispatches the changes to the document frame.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[79]">
<source>Frame is a controller property that returns the main frame for a document. Therefore, the variable named document refers to a document’s frame, which receives dispatched commands.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[80]/text:span[0]">
<source>dispatcher</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[80]/text:span[1]">
<source>=</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[80]/text:span[2]">
<source>createUnoService</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[80]/text:span[3]">
<source>(</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[80]/text:span[4]">
<source>"com.sun.star.frame.DispatchHelper"</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[80]/text:span[5]">
<source>)</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[81]">
<source>Most tasks in LibreOffice are accomplished by dispatching a command. LibreOffice includes<x id="226" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[81]/text:alphabetical-index-mark[0]"/> <x id="227" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[81]/text:alphabetical-index-mark[1]"/>a <g id="228">DispatchHelper</g> service, which provides an easy way to dispatch an URL using one call instead of multiple ones and does most of the work when using dispatches in macros. The method CreateUnoService accepts the name of a service and it tries to create an instance of <x id="229" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[81]/text:soft-page-break[0]"/>that service. On completion, the dispatcher variable contains a reference to a DispatchHelper.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[0]">
<source>dim</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[1]">
<source>args1</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[2]">
<source>(</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[3]">
<source>0</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[4]">
<source>)</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[5]">
<source>as</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[6]">
<source>new</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[7]">
<source>com</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[8]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[9]">
<source>sun</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[10]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[11]">
<source>star</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[12]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[13]">
<source>beans</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[14]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[82]/text:span[15]">
<source>PropertyValue</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[83]">
<source>Declares the <g id="230">args1</g> array of properties. Each property has a name and a value. In other words, it is a name/value pair. The created array has one property at index zero.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[84]">
<source>The <g id="231">com.sun.star.beans.PropertyValue</g> expression is an Universal Network Objects (UNO) <g id="232">srtucture</g>. Structures are special variable type that contane other variables <x id="233" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[84]/text:bookmark[0]"/>united by logical <x id="234" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[84]/text:bookmark[1]"/>basis. They can be convenient to operate with sets of heterogeneous information that should be treated as a single whole. An explanation of UNO and user <g id="235">structures</g> <x id="236" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[84]/text:bookmark[2]"/>goes far beyond the scope of this book.<x id="237" xid="office:document-content[0]/office:body[0]/office:text[0]/text:p[84]/text:bookmark[3]"/> For more information on creating and using structures , see the LibreOffice Help system and other Basic guids.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[85]/text:span[0]">
<source>args1</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[85]/text:span[1]">
<source>(</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[85]/text:span[2]">
<source>0</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[85]/text:span[3]">
<source>).Name</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[85]/text:span[4]">
<source>=</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[85]/text:span[5]">
<source>"Text"</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[86]/text:span[0]">
<source>args1</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[86]/text:span[1]">
<source>(</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[86]/text:span[2]">
<source>0</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[86]/text:span[3]">
<source>).</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[86]/text:span[4]">
<source>Value </source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[86]/text:span[5]">
<source>=</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[86]/text:span[7]">
<source>"Your name"</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[87]">
<source>Gives the property the name “Text” and the value “Your name”, which is the text that is inserted when the macro is run.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[0]">
<source>dispatcher</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[1]">
<source>.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[2]">
<source>executeDispatch</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[3]">
<source>(</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[4]">
<source>document</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[5]">
<source>,</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[6]">
<source> ".uno:InsertText"</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[7]">
<source>, </source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[8]">
<source>""</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[9]">
<source>,</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[10]">
<source> 0</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[11]">
<source>,</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[13]">
<source>args1</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[88]/text:span[14]">
<source>())</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[89]">
<source>This is where the magic happens. The dispatch helper sends a dispatch to the document frame (stored in the variable <g id="238">document</g>) with the command <g id="239">.uno:InsertText</g>. The next two arguments, frame name and search flags, are beyond the scope of this book . The last argument is the array of property values to be used while executing the command InsertText.</source>
</trans-unit>
<trans-unit xml:space="preserve" id="office:document-content[0]/office:body[0]/office:text[0]/text:p[90]/text:span[0]">
<source>end sub</source>
</trans-unit>