Objectives Define what a Macro is

Slides:



Advertisements
Similar presentations
Using VB with MS Applications R. Juhl, Delta College.
Advertisements

© Paradigm Publishing, Inc Excel 2013 Level 2 Unit 2Managing and Integrating Data and the Excel Environment Chapter 7Automating Repetitive Tasks.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Excel Project 7 Using Macros and Visual Basic for Applications (VBA) with Excel.
Using Macros and Visual Basic for Applications (VBA) with Excel
Developing an Excel Application
Tutorial 8: Developing an Excel Application
Microsoft Office Excel 2013 Core Microsoft Office Excel 2013 Core Courseware # 3253 Lesson 8: Macros, Importing and Exporting Data.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
MACROS CS1100 Computer Science and its Applications CS11001.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
With Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2010.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
String Variables Visual Basic for Applications 4.
Customizing Word Microsoft Office Word 2007 Illustrated Complete.
Using the Visual Basic Editor Visual Basic for Applications 1.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Macros for Beginners Patrick Armatis University of Michigan-Dearborn.
Adding Automated Functionality to Office Applications.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1.
Christopher Guertin VAMC – West Palm Beach, FL 1.
Microsoft Office Word 2013 Core Microsoft Office Word 2013 Core Courseware # 3250 Lesson 8: Using Productivity Tools.
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
Visual Basic Chapter 1 Mr. Wangler.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
Project 9 Using Visual Basic for Applications (VBA) to Customize and Automate Excel Jason C. H. Chen, Ph.D. Professor of Management Information Systems.
Microsoft Excel 2007 © Wiley Publishing All Rights Reserved. The L Line The Express Line to Learning L Line.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 22 Macros.
1 CA201 Word Application Increasing Efficiency Week # 13 By Tariq Ibn Aziz Dammam Community college.
Copyright 2007, Paradigm Publishing Inc. EXCEL 2007 Chapter 7 BACKNEXTEND 7-1 LINKS TO OBJECTIVES Record & run a macro Record & run a macro Save as a macro-
Automating Tasks with Visual Basic. Introduction  When can’t find a readymade macro action that does the job you want, you can use Visual Basic code.
Tutorial 11 Using and Writing Visual Basic for Applications Code
Microsoft Excel Macros & Excel Solver (IENG490)
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
Visual Basic for Applications Macro Programming For Microsoft Office.
Intro to Excel - Session 7.31 Tutorial 7 - Session 7.3 Developing an Excel Application.
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
OCC Network Drives  H:\  P:\ 
Key Applications Module Lesson 21 — Access Essentials
Working with the VB IDE. Running a Program u Clicking the”start” tool begins the program u The “break” tool pauses a program in mid-execution u The “end”
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft® Excel 2013.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
Introduction to Microsoft Excel Macros COE 201- Computer Proficiency.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft® Excel 2013.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
1 CA202 Spreadsheet Application Automating Repetitive Tasks with Macros Lecture # 12 Dammam Community College.
AUTOMATED HCES WORKSHEETS OM400, OM500, JB1200 Prepared by OCM 10/27/2008.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Using Macros Lesson.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
The New User Interface MEDITECH Training & Education.
Excel Tutorial 8 Developing an Excel Application
Microsoft Access Illustrated
Microsoft Office Illustrated
Microsoft Excel 2003 Illustrated Complete
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
CIS16 Application Development Programming with Visual Basic
Microsoft Excel 2007 – Level 2
Presentation transcript:

Macros For Reflections Christopher Guertin VAMC – West Palm Beach, FL Christopher.Guertin@VA.GOV 20th /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 Explain when and why we would use a Macro in Reflections Understand basic code Know where to go for more info/help

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

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

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

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

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

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

Getting Started

Sample Reflections Screen

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

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

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

How to Edit Macro Macro  Macros  Edit

Creating Macro Macro  Macros Type in name under Macro Name:

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

Stopping a Macro Macro  Stop Macro Ctrl+Break Create a Button

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

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

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

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

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

Using Macros

Assigning Macro to Key Setup  Keyboard Map

Assigning Macro to Mouse Button Setup  Mouse Map

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

Customizing Buttons

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

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

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)

User Input

User Input Wait for Input into Reflections Input Box User Form Message Box to Help Input Box User Form

Message Box

Input Box

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

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

User Form - WYSIWYG What You See Is What You Get

User Form – How the User Sees It

Examples

Switch Column Size Create Macro Change Column Size

Screen Capture to Text File Logging On/Off

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

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

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

Basic Code

Date Converter Converts Date to Format Useable by VISTA

Format Date / Time strDate = Format(strDate, "dddd, mmm d yyyy") 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

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

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

Variable Life Should be declared Procedure Private Public 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

VB Codes

Ascii Codes

Message Box Code Values

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

More Info

Good Habits Apostrophe Comment Declare Variables at Top 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

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

Help File Can be useful to learn Syntax and Concepts

Help File Methods Properties Events

More Help Pharmacy ADPAC Email Group Attachmate Guide Visual Basic Books / References VBA Books Google SharePoint

The Present/Future SharePoint Site Share Design Ideas http://vaww.infoshare.va.gov/sites/vapharmacyinformatics/WIKI/VBA/Home.aspx Share Design Ideas Integrate Fileman Routines Macro Classes Seamless Data Transfer to MS Office Products VBA / Macro Education Series Reflections MS Office

VBA – Adding to MS Office Products Office Button  Options  Popular Show Developer Tab in the Ribbon

Questions