Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

13
Macros in Microsoft Excel and Word Demo training by Ferenc Nagy

Transcript of Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Page 1: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Macros in Microsoft Excel and Word

Demo trainingby

Ferenc Nagy

Page 2: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

What are the Macros?

Recorded

• repetitive user actions

• multistep tasks on documents

• tedious mcjobs

• must be exactly reproduced

Page 3: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Why We Use Them?

Save our mind to make important decisions

Help the work of our less experienced colleagues

Standardize the look and feel of our reports

Be sure that all necessary steps will be done

Page 4: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Step of Macro Writing and Usage

Planning Recording Starting Cleaning Debugging Saving Loading Exec

Button

Actions Keystrokes Tools Macros New Start VB Editor VBE Debug VBE File Export VBE File Import View Toolbars …

Page 5: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Recording Macros Tools Macros New Properties

• name• hotkey• Place

current document global

• description Press keys, enter data,

click with mouse Suspend, resume,

finish

Page 6: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Methods for Starting Macros

Tools Macros Start

Press hotkey on

property screen

Press button on toolbar

Page 7: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Cleaning of Visual Basic Text

Tools Macros VB Editor What is recorded?

• Not mouse clicks but property changes of VB objects.

Discard:• accidental detours• properties not intended to change

Why?

Page 8: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Debugging Macros

VBE Debug

Stepwise execution

Inspect values of

variables

Topic of advanced

courses

Page 9: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Saving and Loading Macros Tools Macros VB EditorFile Export

• Save macro as .bas or .cls files for future usage

Tools Macros VB EditorFile Import• Load macro as .bas or .cls file to use in

another documents

Page 10: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Definition of an Exec Button

Look for a bitmap or plan a new one

Create a new toolbar for your macros

Place the bitmap and the help text

there

Page 11: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Examples Plain data files Excel worksheets

• Fixed column width checked by validation• Colums delimited by commas and

parentheses Format and print Word documents

• Insert headers, footers, page numbers• Change font size and page orientation• Search and replace

given words or punctuation marks ugly accented characters like ôôõÔÕûÛ ôôõÔÕûÛ to

nice Hungarian őŐűŰ characters

Page 12: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Practice

Record a Word macro1) Replacing all „is” with „is not”2) Paint all „.”-s to red.3) Define header:

„In the name of Allah the compassionate and merciful.”

Record an Excel Macro1) Opening a text file2) Create columns at commas ,3) Delete all parentheses ()4) Insert a heading in the first row

Page 13: Macros in Microsoft Excel and Word Demo training by Ferenc Nagy.

Thank you for the attention.

It’s your turn to learn and use what you have learnt.