in fact some have more than one Photoshop supports three or four depending on

In fact some have more than one photoshop supports

This preview shows page 7 - 19 out of 36 pages.

— in fact, some have more than one! — Photoshop supports three (or four, depending on how you count) Scripting can save you a LOT of work 7
Image of page 7
CS 200 Spring 2020 02 – Styles 8 Automating SpreadSheet Creation — Format with a Macro (1)
Image of page 8
CS 200 Spring 2020 02 – Styles Automating SpreadSheet Creation — Format with a Macro (2) 9 The macro Note the comments, introduced by the character ' — anything from there to the end of the line is ignored (add your own to remind yourself later of things you figure out) This example illustrates speeding spreadsheet development macros are easy to read & usually you can RECORD what you want to do, or something close to it, and just edit the recording look up terms you don’t know with online help (in the VBE environment) eg select a term like ColorIndex and press the help key ' ' Rule_Left_and_Bottom Macro ' Macro recorded 10/12/95 by John C. Beatty ' Sub Rule_Left_and_Bottom() Selection.BorderAround _ Weight := xlThin, _ ColorIndex := xlAutomatic Selection.Borders(xlRight).LineStyle = xlNone Selection.Borders(xlTop).LineStyle = xlNone End Sub
Image of page 9
CS 200 Spring 2020 02 – Styles Automating Use Of A Spreadsheet — Sort Marks This illustrates speeding the use of a spreadsheet 10
Image of page 10
CS 200 Spring 2020 02 – Styles 11 Sub Sort_By_Name2 () Range(" B3:D14 ").Select Selection.Sort _ Key1 := Range(" C3 "), _ Order1 := xlAscending, _ Header := xlGuess, _ OrderCustom := 1, _ MatchCase := False, _ Orientation := xlTopToBottom Range("A1").Select End Sub Sort Marks — By Name _ ” means “the statement continues on the next line” It’s pretty easy to guess what each piece of the Selection.Sort statement does, right?
Image of page 11
CS 200 Spring 2020 02 – Styles 12 Sub Sort_By_Mark2 () Range(" B3:D14 ").Select Selection.Sort _ Key1 := Range(" D3 "), _ Order1 := xlDescending , _ Header := xlGuess, _ OrderCustom := 1, _ MatchCase := False, _ Orientation := xlTopToBottom Range("A1").Select End Sub Sort Marks — By Mark
Image of page 12
CS 200 Spring 2020 02 – Styles 13 The macro Function FtoC ( fTemp ) FtoC = (fTemp - 32) * 5 / 9 End Function illustrates extending an application by means of a macro Note the use of “Function” instead of “Sub” “functions” return a value (the value assigned to their name) “subroutines” don’t — they just “do something” FtoC can be used anywhere a built-in Excel function can be used See also “Marks to Grades” in Week 6 / Files for Lecture: Excel Macros Extending Excel — F to C Conversion Sub Sort_By_Mark2() Range("B3:D14").Select... ... End Sub
Image of page 13
CS 200 Spring 2020 02 – Styles 14 Making a spreadsheet look like a hand-built app
Image of page 14
CS 200 Spring 2020 02 – Styles Excel’s Scripting Environment 15 Selecting Macros... opens the dialog shown above right Note the “Record New Macro...” menu item
Image of page 15
CS 200 Spring 2020 02 – Styles Editing a Macro To edit a macro click the Edit button in the Macros dialog or select “Visual Basic Editor” from the menu shown on the previous slide Note the new menu bar, & especially the View menu in it All the active menu items are interesting 16
Image of page 16
CS 200 Spring 2020 02 – Styles 17 The VBE Environment (The Big Picture)
Image of page 17
CS 200 Spring 2020 02 – Styles Excel vs the Visual Basic Editor A bit like two programs wrapped as one — one dock icon, but with different menu bars and different windows/palettes in the VBE, click on a spreadsheet to “flip back to Excel” (or select “Excel > Close and Return to Microsoft Excel” !)
Image of page 18
Image of page 19

You've reached the end of your free preview.

Want to read all 36 pages?

  • Spring '17
  • Visual Basic for Applications

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture