My PowerPoint Macros

advertisement
My PowerPoint Macros
by Andrew Noske
http://www.andrewnoske.com/
Contents
•
•
•
•
•
•
•
•
•
Introduction
Running Macros
Using these Macros in another PowerPoint document
Problems Running Macros
Using Macros across PowerPoint documents
Attaching/copying Macros in another PowerPoint Doc
Editing Macros
Signing Macros
Final Words
Introduction
• This PowerPoint has several useful Macros attached to it.
• To access these Macros click:
– Tools >> Marco >> Marcos [Alt+F8] (on the toolbar)
– From here you can run, edit, create & delete Macros.
– TIP: get use to pressing [Alt+F8]
Running Macros
• To run Macros:
– If not already hit [Alt+F8]
– Click the macro you want and
hit “Run”
– WARNING: Generally speaking
you cannot undo macros
(especially in MS Excel) and so
it’s a good idea to save a
backup before you run a
new/unfamiliar Macro.
Using these Macros in another
PowerPoint document
• Instructions:
– Make sure this PPT
document is open
– Open/create your own PPT
document.
– Hit [Alt-F8] in your PPT
document, and click
Macro in: “All open
presentations”
– Select the one you want, hit
“Run”
Problems Running Macros
• Sometimes you may find you can’t run
Macros. This is to do with security
settings, and a can be awkward to get
around too.
• Easiest way around this is go:
– Tools >> Macros >> Security … >>
Security Level, change the setting to
“Medium” and click OK.
– Close and reopen PowerPoint before it
takes effect.
• A better method is to use/install
certificates  you do this under
“Trusted Publishers” tab  to create
you OWN certificate is harder – you can
read about it on the “Signing Macros”
slide, or try Google.
Disabled!
Using Macros across PowerPoint
documents
• Unlike MS Excel & MS Word, where you have a place
to store/share Macros across ALL document, you
cannot do the same in PowerPoint.
• I recommend writing all your Macros in a single PPT
file (like this one)… and open this PPT whenever you
wish to run Macros in another PPT.
• However, if you DO want to ATTACH the Macros code
to a different document do the following (next slide)…
Attaching/copying Macros in
another PowerPoint Doc
• Instructions:
– Make sure this PPT document is open
– Open/create your own PPT document.
– Hit [Alt-F8] in your PPT document, type
Marco name: “whatever” in and hit “Create”
– The Visual Basic editor will appear.
– In the Visual Basic editor, navigate to
“PowerPoint_Macros_AN”, select all
[Ctrl+A] the code and copy it [Ctrl+C].
– Navigate back to your new “Module1” select
all [Ctrl+A] and replace your “whatever …”
subroutine with my code.
– You can now close the Visual Basic Editor
(it will save automatically) and then close
this PPT document.
Navigate
Paste/edit
code here
Editing Macros
• To edit Macros:
– Click the macro and hit
“Edit”
– Use the Visual Basic
(VB) window to edit
code.
– TIP: Before you
play around read the
instructions at the
top of my code.
– Once done, you can
save changes, run the
subroutine you are
editing or just close the
VB window (it will save
automatically)
Save
Run
Signing Macros
• If you keep getting warning about Macros you can try using a
digital signature.
• STEPS:
1. Go: Start >> Programs >> Microsoft Office >> Tools >> "Digital
Certificate for VBA Projects”
• This runs a program called “SelfCert.exe”
(which lives in: C:\Program Files\Microsoft Office\OFFICE11\Cert.exe)
2. For certificate name type something like “MyCertificate”. Click OK.
• You have just created your first “digital certificate”, and you can use this
to sign VBA Projects.
3. Open the VB editor window and make sure the module/file you want
to sign is open/selected.
• To get to here you can shortcut click [Alt+F11] from PowerPoint.
4. Click: Tools >> Digital Signatures >> Choose. Select the certificate
you just created. OK your way out and save your file.
• The next time you open this particular file you shouldn’t get any
warnings.
Final Words
• Visual Basic is a babyish language, but hey – Macros
are cool! Macros can save you lots of time doing by
automating repetitive tasks.
• Macro implementation in PowerPoint is not so bad, but
actually I can’t think of THAT many tasks you wound
want to automate in PowerPoint, so their use here is
limited.
• Learning to use Macros in Excel and Word is much
more valuable – if you wish to learn Macros start with
those!
• Visit http://www.andrewnoske.com/ for more cool stuff.
Download