Search notes:

VBA statements

appActivate Activates the window with a given title (caption) or taks id.
beep Makes some noise, possibly in order to get the attention of a user.
call To enter (call) a sub, a function or a procedure in a DLL
chdir Specifies the new current working dir.
chdrive Specifies the new current drive.
close Closes an input or output file.
const Declares a constant value.
date Gets the current system date. Compare with time.
declare Used to locate and call functions in DLLs.
saveSetting, getSetting and deleteSetting Writes, reads or deletes a an entry into the registry under the key HKEY_CURRENT_USER\Software\VB and VBA Program Settings
deftype Specifies the default datatype at module level.
dim Declares variables and associates them with a datatype.
do … loop
end Ends some blocks (subs/functions, if statements etc). Compare with exit.
enum Declares an enumeration type.
erase Re-initializes the elements in an array.
error Simulates an error.
event Declares an event. See also raiseEvent
exit Exits some kind of block. Compare with end.
exit for
filecopy Copies a file.
for See also for each … next. TODO: for … next
for each Iterates over items in a array or a collection.
function
get Reads data from a file.
getattr, setattr Gets or sets a file's attributes (such as read only, hidden etc.)
gosub … return Calls a subroutine with a sub/function.
goto Similar to gosub but does not allow for a return statement.
if (if … then / if … then … else)
implements Used in connection with interfaces.
input# Reads from a file.
kill Deletes one or more file (with wildcards)
let Assigns a value to a variable. let is optional.
line input# Reads a line from a (text) file.
load and unload Loads or removes an object into/from memory.
lock, unlock
lset
mid Replaces characters within (in the middle) of a string-variable.
mkdir Creates a directory.
name Renames files and directories.
on error Poor man's error handling
on...gosub, on...goto
open Open a file. See also reset.
option base Specifies the default number for the first element in an array
option compare Specifies how strings are compared: binary (case sensitive) or text (case insensitive).
option explicit Requires variables to be declared with dim.
option private
print # Writes to a file. Compare with put#
private
property get
property let
property set
public declares global variables.
put Writes to a file. Compare with print.
raiseEvent Raises an event (that was declared with event)
randomize Initializes the random number generator.
redim Re-dimensions an array.
rem Starts a comment (remark). The apostrophe can also be used instead.
reset Closes all files that were opened with open.
resume Resumes (normal?) control flow after an error was handled.
rmdir Removes a directory.
rset
seek
select
sendKeys Simulates typing into the active window
set Might call AddRef of the object's IUnknown.
static Declares a static value in a sub/function. Such variables keep their value across calls.
stop Stops execution (but does not end it).
sub
time Gets the computer system time. Compare with date.
type Creates a user defined datatype.
while...wend Loop over a series of statements as long a given condition is true.
width #
with
write# writes machine-readable text to files.

See also

The colon (:) is the statement separator
VBA language

Index