Beruflich Dokumente
Kultur Dokumente
PCS Argentina
Welcome
This course is aimed at people with no
programming background.
What is VBA?
Visual Basic is a programming language
developed by Microsoft, VBA refers to a
variant aimed at working with Office and
a few other compatible apps.
VBA User Interface
What is a Macro?
A macro is a sequence of user actions
that can be recorded by Office and can
be repeated automatically at any time.
Execute your macro from Execute the macro from the Add some breakpoints and
the Macro List and from a VBA editor (using the play execute your macro fully.
shortcut. button or F5).
Variables & Constants
Other types of variables include: Long, Date, Currency, Decimal, Single, Variant and
Object (this will be very important later on).
Screencast
• Declaring variables: DIM [variable name] AS [datatype]
• Assigning values
• Working with Variables
– Debug a variable value
• Mouseover
• In the Immediate window (Debug.Print, the interrogation mark)
• Declaring constants: CONST [constant name] AS [datatype] = [value]
• Best Practices
Best Practices
Name Variables Appropiately Always use Local Variables Keep “option explicit” in all
Choose descriptive names for AlwaVariables stored outside modules
procedures and variables like procedures are called Global Having Option Explicit at the
“age” instead of “var1”, Variables and using them is top of each module makes it
employ a naming convention considered a bad practice. mandatory to specify variable
and tabulate your code. types. Saving future
headaches.
Conditions Loops
Operators
Introduction
What does control flow mean?
Sometimes we don’t want our program
to execute instructions sequentially.
Instead, we might need it to do one
thing or another depending on a
condition. Or we might need it to do
something multiple times before
continuing.
For While
Description The for loop is run for a fixed number of The while loop is run until a certain condition is
times. met.
When to use it You know the number of iterations you They are best suited when you don’t know
need to do before entering the loop. ahead of time the number of iterations that
you need to do.
Example Dim Counter as Long Do While GamePaused = False
For Counter = 1 To 10
Loop
Next Counter
Screencast
• Loops – Compare using F8
– Do While Loop
• Repeat instructions while the condition is true
• Evaluation can be at beginning or end
– Do Until Loop
• Repeat instructions until the condition becomes true
• Evaluation can be at beginning or end
– For Loop
• Repeat an instruction a fixed number of times
– Best Practices
Best Practices
What is modularization?
Dividing a program into smaller parts of
code where each piece handles a
specific task is known as modularization.
Sub ShowAlert()
Debug.Print “Alert!" What are sub-procedures?
End Sub The basic procedures in VBA are called
Subs and are enclosed by a Sub and End
Sub statement.
Sub ProceduresSample()
ShowAlert ‘ Execute procedure
Once a Sub is defined it can be called
End Sub anywhere on your code.
Parameters
C) Calculator
B) Which Is Longest Create a function that receives
A) Is it positive? Create a function that receives two numbers and a string with
Write a function that an operator such as “+”, “-”,
two strings and returns the
“*”, “/”. The function should do
receives a number, and longest one. the operation between the two
returns true if it’s positive numbers and return the result.
or false if it’s not. Tip: Use the pre defined
function LEN() Use this function in a
Use this function in a procedure and print it’s result.
procedure and print it’s
result.
Best Practices
Open
Knob
Object
Knock
Color Property
Save
Name
Remember you can set Application.ScreenUpdating to False before your code for better performance.
It’s time for a break
VBA User Interfaces
List Box
Toggle Button
Working with Controls
C) Add a Sheet
B) Say Hello by Name Add radio buttons with 3
A) Say Hello Add a Text Box Control to different greetings like:
Create a procedure that uses write a name and modify Hello, Bye, Good Morning
the pre-defined function the previous program so and modify the previous
MsgBox to say Hello. that it greets you based on program so that it greets
whatever name you typed. you based on your choice
Create a button that executes of greeting and input
your sub. name.
It should not greet you if
your name is Alice.
It’s time for a break
Working with Forms
What is a Form?
Forms are a yet another way to allow
users interact with your program.
C) Register To Training
B) Training Create a form with an input
A) Show a Form Create a form with an input to write for an email address, and
your name and a checkbox saying “I three trainings to choose
Create a new form and add it a accept the terms and conditions”.
Quit button that closes it. froom.
Add an Ok button. On click if you
Create an ActiveX control that accepted the terms and conditions it When the ok button is
opens the form. should show your name else it clicked add the submitted
should show the message “Please
accept the terms and conditions” data to the end of the
Experiment with different (use the function msgbox). atendees list.
properties and methods of
User Forms and User Form
Controls.
Common Excel Case Scenarios
C) Confirmation Email
B) Make All Cells Visible Import the class Outlook
Create a macro that makes Utils and create a macro that
all cells in the ActiveSheet iterates through the list of
visible. atendees from module 6 and
creates an email draft for
each one with the text: “You
Save this Macro to a have been registered
module in your personal successfuly to the training
Workbook and add it to [Training name]”.
your ribbon bar.
Q&A
Use this time to ask any questions or request
any topics you want explained.
Keep Learning
There are a lot of great resources to help you.
Blue Prism's Robotic Automation software enables business operations to be agile and cost effective
through rapid automation of manual, rules based, back office administrative processes, reducing cost
and improving accuracy by creating a "virtual workforce".
The virtual workforce is built by the operational teams or accredited Blue Prism partners using our
robotic automation technology to rapidly build and deploy automations through leveraging the
presentation layer of existing enterprise applications. The automations are configured and managed
within an IT governed framework and operating model which has been iteratively developed through
numerous large scale and complex deployments
Introduction to Blue Prism
Install Software
Become familiar with Blue Prism
• Process Studio
• Interfaces & Main Commands
• Sample Exercises
Become familiar with Blue Prism
Process Studio
Become familiar with Blue Prism
Become familiar with Blue Prism
Become familiar with Blue Prism
Interface & Main Commands
Become familiar with Blue Prism
Become familiar with Blue Prism
Become familiar with Blue Prism
Become familiar with Blue Prism
Example Exercise
Practice and Exercises
• ….
Exercise (1)
Excel: Getting Values (from a DataRange)
• ….
Exercise (2)
Excel: Getting Values (from a DataRange)
BluePrism Tips:
Create an Excel Instance.
Make visible the Excel instance. (Show)
Select the ‘Ciudades’ sheet, and set the focus in the “A1” cell. (Activ. Worksheet – Got to cell)
Scroll through all the ‘Column A’ cells, assigning each value into a BP Data.
Finish the robot process when has reached the las cell of the data range ( Go to next cell -
• ….
Exercise (2)
Collections
BluePrism Tips:
Be sure to specify the correct file path for the Excel file.
Give the browser approppriate time to show the search results on the screen.
Exercise (3)
Identifying Objects
• ….
Exercise (3)
Identifying Objects
Finally, you’re
able to start
building your
robotics
design.
Exercise (4)
Exceptions
• ….
Sample Exercise: Exceptions
Forcing an Error
We have a division example.
A value is divided by a divisor
number.
Then, a calc sustract 1 (one) unit
to the divisor number 1, and put
the whole operation in a loop.
In some time, the divisor number
will be 0 (zero) and the process
will show an error.
Sample Exercise: Exceptions
Forcing an Error
The errors appears clearly…
Sample Exercise: Exceptions
Adding the Exception and a recovery stage
• ….
Sample Exercise: Cycles and Loops
Controlling repetitive processes
BluePrism Tips:
Use one Data Set for the row number and another for the column number.
Make sure the variables do not exceed the máximum row and column numbers.
Exercise (6)
Decision
• ….
Simple Decision
BluePrism Tips:
Use two or more places.
Be sure to take into account the possibility of the person choosing a non-listed retailer.
Choice of beverages and/or retailers is personal. May be whichever, provided that the
exercise can be done.
Final Exercises
Using the Excel file called “Listado Provincias”:
• For each province in the list, look up the population in Google, writing
“[province name] población”.
• Store the population in the Excel file, column B, right of the name.
• For the most and least populated provinces: search for activities to be
done in it.
• Sort the list in descending order.
OPTIONAL EXERCISE:
• Develope a robot for a process of your choice.
Thanks for coming
Have a nice day!