Slide Show
Outline
1
Macros And You!
  • By Ruth Helwig, Systems Librarian
  • Central Michigan University
  • February 1, 2007
2
What is a Macro?
  • A macro is a way to record repetitive keystrokes to avoid retyping.
  • A macro can save you time.
  • A macro can be simple or tricky to create.



3
Where can I create macros?
  • Microsoft Word
  • Microsoft Excel
  • Microsoft Access – to some extent
  • III’s Millennium
  • Anzio
  • Connexion
4
In MSWord
5
What to watch for!
  • Patterns in the content
  • Watch for uniqueness
  • Order of commands –
    • A change will change everything that matches the pattern.
    • Changing “cat” to “gray cat” will also change “category” to “gray category”
  • May need to change something and change it back
6
Saving macro content!
  • Marcos in III are saved by Login on the server.
  • Macros in Anzio and Connexion Client are located on your computer.
  • Macros in MSWord and Excel are on your computer.
  • TIP – Once the macro is created and working, make a copy of the steps in case it is lost.


7
Example - Text to change with a macro
  • 030673 .b14575693   700 1b 1994 A^10  Newell, Charles J.^
  • 011116 .b14368808   700 1b 1991 A^10:Schumacher, Vic.^
  • 002535 .b1162355x   700 0b 1975 A^A 17th Century Tourist.^
  • 042393 .b1151565x   700 0b 1828 A^A citizen of New-England.^
  • 030189 .b13504319   700 0b 1928 A^A citizen of Paris.^
  • 018285 .b12852466   700 0b 1957 A^A co-founder.^
  • 047497 .b11037222   600 10 1969 A^a Copland, Aaron,^D^1900-1990.^T^Concertos,^M^clarinet, string    orchestra.^
  • 029946 .b12442197   700 0b 1970 A^A F. R. G. S.^
  • 044979 .b1716154x   700 0b 1971 A^A gentleman.^
  • 021317 .b16859388   700 0b 2001 A^a Kamalasila,^D^fl. 713-763.^T^Bhavanakrama.^L^Sanskrit & Tibetan.^
  • 038661 .b1841896x   100 0b 1851 A^A. Novice.^
  • 045056 .b17162324   700 0b 1972 A^A victim.^
  • 048818 .b1585372x   600 10      A^A. Walthew & Sons (Detroit, Mich.)^
  • 003964 .b11638540   100 1b 1946 A^Aaberg, Gwendolyn M.^
  • 036403 .b14100939   600 10 1991 A^Aakvik, Helmer,^D^d. 1987.^
  • 020461 .b13401087   700 1b 1967 A^Aall, Ingrid.^
  • 017050 .b10712471   700 1b 1980 A^Aandahl, Frederick.^
8
Steps for Creating the Macro
  • Decide what you want to achieve.
    • Change content
    • Add content
  • Examine the data for patterns.
  • In this example:
    • 6 digits followed by a space
    • Space .b followed by 8 digits
    • Space followed by 3 digits, etc.
    • A^A
9
Write down and Test the steps
  • Replace A^A with A
  • Replace .b with TAB .b
  • Remove all remaining carets ^
  • Start a new line of text with the MARC tag
  • Add “record number =“ before the bib record number.


10
Recording and Running the Macro
  • Choose Record
  • Type the Find and Replace steps that you want the macro to perform.
  • Stop and save the macro.
  • In the future, you only need to run the macro.
    • à Tools à Macro à Macros à select Macro à Run à Sit back and relax
11
Record the macro
12
Perform the steps you wrote down
13
Stop Recording
  • And save the macro


14
This is what the macro looks like when it is stored.
  • Sub recacq2()
  • '
  • ' recacq2 Macro
  • ' Macro recorded 11/2/99 by 93735RuthHelwig
  • '


  • '
  •     Columns("B:B").Select
  •     Selection.Replace What:="<b>A ", Replacement:="<b>", LookAt:=xlPart, _
  •         SearchOrder:=xlByRows, MatchCase:=False
  •     Selection.Replace What:="<b>The  ", Replacement:="<b>", LookAt:=xlPart, _
  •         SearchOrder:=xlByRows, MatchCase:=False
  •     Selection.Replace What:="<b>An ", Replacement:="<b>", LookAt:=xlPart, _
  •         SearchOrder:=xlByRows, MatchCase:=False
  •     Selection.Replace What:="<b>The ", Replacement:="<b>", LookAt:=xlPart, _
  •         SearchOrder:=xlByRows, MatchCase:=False
  • End Sub
15
In Excel
16
Using Find and Replace to Create Macros in Excel
  • In Excel you can focus changes to a specific column, match case, or match the entire cell contents



17
Macros in MSAccess
18
MSAccess cont.
  • Click “New” and you get a list of actions.


19
MSAccess cont
  • Choose an action from the drop-down menu.
  • Specify a source for the action.  Example:
    • Action = Open
    • Action = Maximize
    • Source = III Problem Table
  • Save and run the macro.
    • The macro above would open and maximize the III Problem Table.
20
Find and Replace in MSAccess
  • MSAccess allows for Find and Replace functions specifying changes to portions of a field.


21
Millennium Macros
  • Tip sheet:
  • http://www.lib.cmich.edu/staff/training/Macros.doc
22
Millennium cont. – Go to Admin àSettings àMacros
23
Millennium cont.
  • Insert string of text that you want to repeatedly enter.
  • Enter a command such as %ENTER%n%TAB%Give to Ruth.
    • This means:
      • % = start or end a command
      • ENTER = press the Enter key
      • n = press “n” together with the ALT key.  In this context it makes a note field.
      • %TAB% = Tab in the line
      • Give to Ruth = Text to put in the field.


24
Macros in Connexion
25
Click “New Macro” to Start
26
Enter macro Name and Description
27
Stop Recording
28
This is how the macro is stored
29
Macros in Anzio
  • See http://www.lib.cmich.edu/staff/anzio.htm
30
Function keys (macros) in Anzio
  • Click CTRL-SHIFT-F
  • You get
  • Type “define”
  • Press the key you want to define, i.e. F10
  • Press the space bar
  • Enter the command or text string à NEXT
  • Press ENTER when you are done. SCREEN
31
Example of Function key in Anzio
  • f11  cafrmh|#|br1-2|yyc