1 / 63

Macros For Reflections

Macros For Reflections. Christopher Guertin VAMC – West Palm Beach, FL Christopher.Guertin@VA.GOV. 20 th /June 2012. Objectives. Define what a Macro is Tell the differences between VB and VBA Be able to Create/Record/Edit a Macro Be able to Import/Export a Macro

nadine-beck
Télécharger la présentation

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 20th /June 2012

  2. Objectives • Define what a Macro is • Tell the differences between VB and VBA • Be able to Create/Record/Edit a Macro • Be able to Import/Export a Macro • Explain when and why we would use a Macro in Reflections • Understand basic code • Know where to go for more info/help

  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 • Run complex data/code • Manipulate data into more useable form • Passing Data Between Applications • Error Checking and Handling

  7. Benefits of Macros for Reflections • Easy to use and share • Change Screen Fonts, Color, Size • Assign Functions to Buttons, Keys, Mouse, Events • Allow User Input for Fileman Reports • Allow Fileman Reports to be Dynamic • Clean up “Dirty Data” • Complete Repetitive Tasks • 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. Getting Started

  10. Sample Reflections Screen

  11. Where to find • If the Macro Menu is not listed please follow step in word document

  12. 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

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

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

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

  16. Run Macro • Open the saved Vista Reflections session • There are two ways to run the macro: • By pressing the newly created button for macro • Alternative way is run macro from the Macro menu • Select Macro menu on the main Vista screen • Select Macros submenu to open a Macros screen • On Macros tab select the desired macro and press Run button • The macro will start running and may prompt user for input

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

  18. Import Macro • Select Macro menu on the main Vista screen • Select Macros… submenu to open the Macros screen • On the Macros screen select Macro File tab • Press Browse… button to open Select a Macro File window

  19. Import Macro (cont…) • On the Select a Macro File screen select the desired macro (.rma file) • Click OK button • Macro name will appear in the Macro file name field on the Macros screen • Press Import button to import macro

  20. Importing Forms • Macro  Visual Basic Editor (Alt+F11) • In Visual Basic Editor • File  Import File • Select .frm file • When highlighted click Open • Make sure the .frm and .frx are in the same folder

  21. Importing Forms(cont.) • In Project • Click + next to Form • The form you imported should now display • Double click on the form you added and it will appear

  22. Adding / Removing Object Libraries • Macro  Visual Basic Editor (Alt+F11) • Tools  References • Check Box • Checked Add • UNcheck Remove • Click OK

  23. Using Macros

  24. Assigning Macro to Key • Setup  Keyboard Map

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

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

  27. Customizing Buttons

  28. Event • Setup  Events • Highlight Event Requested • Click Properties to View/Edit • Or New to Create One

  29. Event(cont.) • Event Type: • Enabled • Text • Run this Event • Action • Macro • Visual Basic

  30. Save Vista Reflections Session • Select File menu on the main Vista Reflections screen • Select Save As… submenu to open the Save Settings screen • On the Save Settings screen select the desired directory to save the session in (you will not be able to save the session in the default directory) • Type the new file name for the session and press Save button (make sure the file extension is .r2w)

  31. User Input

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

  33. Message Box

  34. Input Box

  35. User Input - form • Many Input boxes can be used or one user form • Default Values may be set

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

  37. User Form - WYSIWYG • What You See Is What You Get

  38. User Form – How the User Sees It

  39. Examples

  40. Switch Column Size • Create Macro Change Column Size

  41. Screen Capture to Text FileLogging On/Off

  42. Prescription Fileman • Easy to Use Interface • Fileman Access Required • No Need to Know Fileman • Allow Direct to Excel • 2 Drugs • Drug + Allergy • Customizable output

  43. Prescription Converter • Can Use Fileman to get data • Allows Rxs to be converted one at a time • Automate Complex Process • Saves Time Money • Offers Consistency • Can Send/Receive Data Directly from Excel

  44. More Examples • SharePoint • http://vaww.infoshare.va.gov/sites/vapharmacyinformatics/WIKI/VBA/Home.aspx

  45. Basic Code

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

  47. 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

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

  49. 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

  50. 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

More Related