VBA for technical writers - demo script
Upcoming SlideShare
Loading in...5
×
 

VBA for technical writers - demo script

on

  • 1,514 views

Script to accompany the slides with the same title (VBA for technical writers). These are resources from a talk given by Adrian Morse at Technical Communication UK 2011.

Script to accompany the slides with the same title (VBA for technical writers). These are resources from a talk given by Adrian Morse at Technical Communication UK 2011.

Statistics

Views

Total Views
1,514
Views on SlideShare
1,514
Embed Views
0

Actions

Likes
0
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

VBA for technical writers - demo script VBA for technical writers - demo script Document Transcript

  • DEMO SCRIPT, VBA for Technical Writers<br />DemoInstructionsThe blue monkeyPLSTableListStarterOpen demo.docm. Click Developer>Record Macro…Name the macro “BlueMonkey” and keep in document, not template.Type “monkey”, use left arrow to select it.Apply bold, arial, 24pt, blue. Add a new pgf.Stop recording macro.ALT + F11 to open VB Editor.The bold blue monkeyPLSTableListStarterIn the VB Editor, open the module containing the blue monkey macro.Show empty demo.docm side by side. Make sure bold is turned OFF.Click F8 to step through macro and show that bold is applied.Now make sure bold is turned ON.Click F8 to step through and show bold is toggled off.Next to Selection.font.bold change wdToggle to True.With bold turned ON, run the macro again. Point out the bold has not been toggled off this time.The responsive blue monkeyPLSTableListStarterIn the VB Editor…cut blue monkey code from module and paste in ThisDocument in an “open” event.Delete all contents of document and turn bold off.Save and close document (do not close Word).Reopen document. Show that the macro runs.The inquisitive blue monkeyPLSTableListStarterClear the document.In the VB Editor, create a userform with a label and two buttons – yes and no.Copy the code from ThisDocument to the Yes button.In ThisDocument, remove the code and replace with:Load userform1Userform1.showFor both Yes and No buttons, add the following at the start:Unload userform1Save and close document (do not close Word).Reopen document. Show there is now a GUI.The loopy blue monkeyPLSTableListStarterClear the document.In the VB Editor userform, open the Yes button code and add the following around the code:For x = 1 to 10….Next xSave and close document (do not close Word).Reopen document. Show the word monkey appears 10 times.The increasingly loopy blue monkeyPLSTableListStarterClear the document.In the VB Editor userform, open the Yes button code and change the font setting to 24 + 2*x.Save and close document (do not close Word).Reopen document. Show the word monkey appears 10 times.The conditional blue monkeyPLSTableListStarterClear the document.In the VB Editor, add the following to ThisDocument:If ActiveDocument.Name = "Blue.docm" Then …Else: MsgBox (“Rename the document to Blue.docm")End IfSave and close document (do not close Word).Reopen document. Show the msgbox appears.Close the document.Rename the file to Blue.docm.Reopen document. Show the blue macro code runs.<br />