1 / 67

Macros For Reflections

Macros For Reflections. Christopher Guertin VAMC – West Palm Beach, FL Christopher.Guertin@VA.GOV. Objectives. Define what a Macro is Tell the differences between VB and VBA Record a Macro Edit a Recorded Macro Create a Macro Explain when and why we would use a Macro in Reflections.

chinara
Download Presentation

Macros For Reflections

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Macros For Reflections Christopher Guertin VAMC – West Palm Beach, FL Christopher.Guertin@VA.GOV

  2. Objectives • Define what a Macro is • Tell the differences between VB and VBA • Record a Macro • Edit a Recorded Macro • Create a Macro • Explain when and why we would use a Macro in Reflections

  3. What is a Macro • Macro (noun) Webster Dictionary • a single computer instruction that stands for a sequence of operations • Sometimes referred to as: Macroinstruction

  4. VB vs VBA VB – Visual Basic VBA- Visual Basic For Applications Requires an Application Reflections Excel Word Access Is complied and run within inside the host only Uses same Syntax as VB • Standalone • Can be used complied into an executable and run outside the host • Uses same syntax as VBA

  5. Why use a Macro • Saves Times • Consistent Data • Easy to make both minor and major changes • Exportable / Importable • Multiple + Easier to use interfaces • Allows for User Input • Software Already Available

  6. What a Macro Can Do • Automating almost anything • Mouse, Keyboard, Options on Menu • Creating Dialog Boxes or User Forms • Passing Data Between Applications • Error Checking and Handling

  7. Benefits of Macros for Reflections • Examples: • Change Screen Fonts, Color, Size • Assign Functions to Keys • Allow User Input for Fileman Reports • Allow Fileman Reports to be Dynamic • Clean up “Dirty Data” • Complete Repetitive Tasks • Works well with Fileman • Transfer Data to/from MS Office Products • No Programmer Access Required

  8. Security • DO NOT put your username or password into a macro to use as an AutoLogin • Code Entered is generally not considered Encrypted

  9. Sample Reflections Screen

  10. Naming a Macro • Must start with letter • May Contain Numbers, Letters • May use an Underscore • 80 Character Max • No Special Characters or Spaces • Example: INPT_WORKLOAD_2011

  11. How to Record • Macro  Start Recording • Stop, Pause, Annotate • Can Edit, Create button, Map to key

  12. How to Edit Macro • Macro  Macros  Edit

  13. Creating Macro • Macro  Macros • Type in name under Macro Name:

  14. Assigning Macro to Key • Setup  Keyboard Map

  15. Assigning Macro to Mouse Button • Setup  Mouse Map

  16. Assigning to Button on Toolbar • Right Click Tool Bar • Setup  Toolbars Customize  New Button • After Recording – Check – Create Button

  17. Customizing Buttons

  18. Stopping a Macro • Macro  Stop Macro • Ctrl+Break • Create a Button

  19. Saving Macro • File  Save As

  20. Saving Tool Bars • Setup Toolbar…  Settings

  21. VBA – Adding to MS Office Products

  22. Customize Quick Access Toolbar • Customize Quick Access Toolbar  More Commands  Customize

  23. Adding / Removing Object Libraries • Tools  References

  24. User Input • Wait for Input into Reflections • Message Box to Help • Input Box • User Form

  25. Message Box

  26. Input Box

  27. User Form

  28. User Form • Could be a course all by itself • Many Options • Label • Text Box • Combo Box • List Box

  29. User Form - WYSIWYG

  30. User Form – How the User Sees It

  31. Date Converter • Converts Date to Format Useable by VISTA

  32. Format Date / Time • Format() • Format(expression[, format[, firstdayofweek[, firstweekofyear]]]) • strDate = Format(strDate, "dddd,mmm d yyyy") • Wednesday, Aug 3 2011 • MyStr = Format(strTime, "hh:mm:ss AMPM") • 05:14:03 AM

  33. Expressions • Operators • Arithmetic • +, -, *, / • Comparison • >, < , = • Concatenation • &, + • Logical • And, Not, Or

  34. Variables • Variables • Naming • Must start with letter • Can be up to 255 characters • Cannot contain a Space but can use underscore • Cannot contain Operators or Special Characters

  35. Variable Life • Should be declared • Procedure • Only for that Procedure • Automatically declared • Dim strDRUG as String • Private • All Procedures in the Module • Private strDRUG as String • Public • All Procedures in All Modules of Project • Public strDRUG as String

  36. VB Codes

  37. Ascii Codes

  38. Message Box

  39. Statements • If - Then • If – Then – Else • If – Then – ElseIf – Else • GoTo • Select Case

  40. Loops • For – Next • For Each – Next • Do While – Loop • Do – Loop While • While – Wend • Do Until – Loop • Do – Loop Until

  41. Comparison Operators

  42. Logical Operators

  43. Functions • Format • Transmit • WaitForString • Ucase • Lcase • Able to create your own • Allows for only one set of code(refer to it)

  44. Good Habits • ‘ Apostrophe • for comment(will not run) • Comment • Top: User, Date, Explain Function • After Code • Declare Variables at Top • TALLman Lettering • Use Error Handler • Try to make more universal

  45. Good Habits • Create in Test Account if possible • Be careful and use checks when user will be creating orders • Validate Data

  46. Switch Column Size • Create Buttons to Change Column Size

  47. Screen Capture to Text FileLogging On/Off

  48. Changing the Color of the Screen • Differentiate Screens • Allows users to easily change to preferred color scheme

  49. How to Run Macro • Macro  Macros • Select from list and click Run

  50. Run a Macro • Click on Button Created

More Related