Class Notes (1,016,905)
CA (584,419)
U of C (7,220)
CPSC (122)
Lecture 25

CPSC 203 Lecture 25: Lectures 22-23-25Premium

5 pages82 viewsFall 2018

Department
Computer Science
Course Code
CPSC 203
Professor
James Roger Tam
Lecture
25

This preview shows page 1. to view the full 5 pages of the document.
OCTOBER 22
W8- Lecture 26
VBA: Visual basic for applications
We need a language that allows us to write a computer program
Seldom used
Not the same as VB, but similar
Macro language: allows a computer to be recorded (like my IT lab but this will create a
program)
WARNING!!
VBA programs:
1. Will modify word documents: not recommended to leave word docs open
MACROS AND THE WEB-BASED OFFICE (365)
OCTOBER 23
W8- Lecture 27
How to enable Developer :
1. Options
2. Customize ribbon
3. Developer
Creating VBA programs
Method #1
Recording a Macro
1. Macro
2. Change name
3. Change default saving “all”
4. Do what you want to do “bold”
5. Stop recording
6. View recording macros
Useful for printing
Entering hard to spell words (especially if they are new)
It’s very limited
Method #2
1. Developer
2. Macros
You're Reading a Preview

Unlock to view full version

Subscribers Only

Only half of the first page are available for preview. Some parts have been intentionally blurred.

Subscribers Only
3. Create a new one “FirstmacrosayHello”
4. Takes you to the Macro editor
Advise: Copy past all the programing to a word document just in case something goes
wrong.
SAVE IT IN THE CURRENT DOCUMENT!!
Format
You put your instructions in the middle “ between sub and sub”
For this class you only need to define a single Sub
Summary:
Save the VBA macro in the current word doc
AND you saved that document as a word macro-enabled doc
Copy-past the VBA program into the body of regular word doc
Message Box
Sub
Msgbox ( say hello)
Sub
Naming Standards:
The name should summarize what the program is supposed to do
Call it after the sub
Choosing A name : VBA Technical Requirements
Sub “ Name of the sub”
1. Must start with an alphabetic letter after than my combination of letters and
numbers may be used
2. No space
OCTOBER 25
October 24th a special guest came
“Lecture 29- W8”
Program Documentation
When dealing with mini Assignment-
Assignment #3
Your VBA assignment has to be marked to indicate that is documentation.
Documentation is not executed.
1. You must ‘mark’ this information so it doesn’t cause an error
The marking will indicate to the VBA translation mechanism that the line is for the
reader of the program and not to be translated and executed
The marking is done with the single quote
You're Reading a Preview

Unlock to view full version

Subscribers Only

Loved by over 2.2 million students

Over 90% improved by at least one letter grade.