VBA / Excel / Access / Word examples (example source code) Organized by topic






Excel /

ActiveCell 39ActiveWorkbook 17
ActiveWorksheet 14AdvancedFilter 3
AutoFill 1AutoFilter 21
Binding 8Cell Comments 7
Cell Copy 1Cell Format 11
Cell Number Format 1Cell Protected 1
Cell Reference 7Cell Value 11
Cell 12Cells 12
Chart Event 9Chart Export 2
Chart Format 27Chart Lengend 2
Chart Protect 2Chart Title 5
Chart 36Column 17
ComboBox 2Copy Paste 5
Count 1CountA 1
Data Refresh 1Evaluate 2
Excel to XML 1Excel ADO 5
Excel Buildin Function 7Excel Dialog 2
Excel Recordset 2Excel Sort 1
Excel to Text File 3Excel Toolbar 2
Excel Transfer 3Excel XML 12
Excel 3ExecuteExcel4Macro 2
FormatConditions 21Formula 9
Hyperlinks 2Minute 1
Month 3Name Create 7
Name 31Page Break 9
Page Orientation 1PivotChart 1
PivotTable 11Range Add 4
Range Copy Cut Paste 10Range Format 30
Range Intersect 2Range Loop 6
Range Name 2Range Permission 3
Range Print 1Range Reference 20
Range Union 4Range Value 6
Range 31Row Format 4
Row 13Selection Format 2
Selection 13Shape 6
Shapes 5SpecialCells 12
SUM 3Text to Excel 4
Watch 1Workbook Encryption 2
Workbook Event 24Workbook File 12
Workbook Links 3Workbook Password 3
Workbook Permission 5Workbook Protect 4
Workbook SaveAs 10Workbook Share 3
Workbook Template 5Workbook 26
Workbooks 32Worksheet Add 8
Worksheet Event 33Worksheet Export Import 3
Worksheet Format 1Worksheet Hide 9
Worksheet Move 4Worksheet OnEntry 1
Worksheet Page Header Footer 3Worksheet Print Setting 2
Worksheet Protection 9Worksheet Sort 2
Worksheet 16WorksheetFunction 11
Worksheets 10

Access /

Access ADO 4Access Environment 7
Access Import Export 11Access to Excel 2
Access to Word 1Access XML 4
ADO Data Type 3ADO Error 1
ADODB Command 3ADODB.Connection 7
ADOMD 1AllTables 4
Autonumber 2Column Constraint 3
Connection String 1CurrentData 3
CurrentProject Connection 2CurrentProject 10
Database Compact 1Database Create 1
Database Encrypt 1Database File 3
Database Link 3Database Password 6
Database Properties 6Database Protect 3
Database Replica 2Database Transfer 7
dBASE ADO 2DBEngine 3
Group Account 15Index 12
Key 6Lock 6
Microsoft Jet 10OLEDB 5
Oracle 1Primary Key 4
Query 13QueryTable 3
Recordset Add Update Delete 12Recordset Bookmark 5
Recordset Convert 1Recordset Count 2
Recordset Cursor 20Recordset Delete 2
Recordset Field 4Recordset Filter 7
Recordset Find 10Recordset Open 27
Recordset Save 2Recordset Seek 3
Recordset Sort 1Recordset Support 4
Recordset to File 2Recordset to XML 2
Recordset Update 3Recordset 22
Relationship 3Report Event 9
Report 5Reports 2
SQL Parameter 6SQL Select 30
SQL Table Join 1SQL Update 5
SQLServer 6Stored Procedure 7
Table Column Field 20Table Copy 1
Table Create 9Table Delete 2
Table Join 2Table Output 2
Table Properties 6Table Type 2
Table Update 2TableDefs 7
Text ADO 1Text Transfer 2
Transaction 4UsedRange 5
User Access 6User Account 12
View 5Workspaces 13

PowerPoint /

ActivePresentation 5Exchange ADO 1
PowerPoint Format 8PowerPoint Slide 3
PowerPoint 3Presentations 1
Slide Edit 10Slide Export Save 12
Slide Master 7Slide Print 2
Slide Shape 8Slide Show 17
Slide Tempalte 3Slide Text 9
Slide Transition 1

Word /

ActiveDocument 15Document Format 2
Document Header Footer 11Document Print 2
Document Selection 4Document Table 33
Document View 7Documents 4
Word Bookmark 3Word Document Print 2
Word Document 10Word Format 2
Word Text 3Word 3

Outlook /

Email Attachment 2Email Send 1
Email 9InternetExplorer 1
MailMerge 2Outlook Calendar 2
Outlook Contact 6Outlook NameSpace 17
Outlook Table 2Outlook Task 4
Outlook 2

Application /

ActiveInspector 4ActiveWindow 13
AddIns 2Application DoEvent 1
Application Events 4Application OnKey 6
Application OnTime 8Application SendKeys 2
Application Windows 7Application.DisplayAlerts 1
Application.FileSearch 2Application 40
Broken Reference 1Color Constant 9
Column Type 2CommandBar 53
CreateObject 1Dialogs 7
DoCmd 18Environ 1
GetObject 2Immediate Window 1
Menu 32Office Permmison 7
Options 13References 2
SearchScopes 1SmartTag 2
StatusBar 2VBE 10
Windows 6

Forms /

CheckBox 3Dir 5
Find 8Focus 1
Form Control 10Form Events 16
Form Recordset 1Form 13
Forms 2Image 1
Label 2ListBox 11
Mouse 3Replace 3
ScrollBar 1SpinButton 5
Spleash Screen 1TextBox 4

Windows API /

CPU Processor 2MDI Sound 1
OSVERSIONINFO 1Printer 5
Registry 5Screen Resolution 2
Shell 6Sound 2
System Memory 1SYSTEM_INFO 1
Wav Sound 2Win32 API 1
Window Installation 4Windows API 5
Windows Resources 18Windows User 2

XML /

DOMDocument 5XML Data 5
XML Export 2XML Transformed 1
XmlMap 2

Data Type /

Array Erase 2Array Function 4
Array Sort 5Array 27
Boolean 5Byte 2
Collection 14Currency Format 3
Data Type 3Date Type 7
Double 3Enum 3
Int 3Integer 9
IS 1Long 2
Multidimensional Arrays 2Null 3
Object Variable Set 12OLE Equation 1
OLE Objects 1OLEObject 1
Single 3String Function 15
String 6Time 3
Type Mismatch 1Type 4
TypeName 7Val 3
Variant 11varType 4

Data Type Functions /

CBool 1CByte 1
CCur 2CDate 1
CDbl 1CDec 1
Char 3ChDir 1
ChDrive 1Chr 2
CInt 2Class 9
CLng 1CSng 2
CStr 1CVar 1
Data Type Convert 5Format 9
FormatCurrency 1FormatDateTime 1
FormatNumber 1FormatPercent 1
IsArray 2IsEmpty 3
IsNull 3IsNumeric 2
LBound UBound 2

Language Basics /

ActiveForm 1ByVal ByRef 4
Call 3Comparison Operators 4
Compiler Directive 4Conditional Compilation 1
Const 9Debug.Assert 2
Debug.Print 2Do Until 5
Do While 10Error Handler 11
Error 18Exit 3
For Each 6For 11
Function Parameter 19Function Return 7
Function 11GoTo 4
IF 18IIF 4
InputBox 20Logical Operators 6
Mathematical Operators 2MsgBox 30
Optional Arguments 1ParamArray 1
Recursive 3Resume 3
Select 13Static variable 4
Sub 14Variable Declaration 6
Variable Scope 10Variable Type 5
Variable 3While 1
With 3

File Path /

Binary File 2CSV 6
CurDir 3Drive 10
File Name 2File Read Write 2
File 9FileDateTime 5
FileDialog 10FileLen 1
FileSearch 9FileSystemObject 6
FileTypes 1Folder Dialog 1
Folder 2FreeFile 8
GetOpenFilename 5Image Object 1
Kill 2ListObject 3
Path 3Print to File 1
Random Access Files 3SearchFolders 1
Sequential Access Files 3Text File 8
TextStream 3WinHttpRequest 1

Date Functions /

Currency Type 2Date Format 49
Date 2DateAdd 3
DateDiff 9DatePart 15
DateSerial 4DateValue 3
Day 2Dynamic Array 8
Hour 2MonthName 4
Now 3Number Format 15
Second 1Timer Function 1
TimeSerial 3TimeValue 6
Weekday 5WeekdayName 3
Year 2

Math Functions /

Abs 2Atn 2
Cos 2Exp 2
Fix 4Log 2
Rnd 3Sgn 4
Sin 2Sqr 2
Tan 2

String Functions /

Asc 1InStr 1
ISLIKE 1LCase 1
Left 2len 3
Like 2Mid 2
Right 2Space 1
Str 2StrComp 2
StrConv 8String Replace 1
StrReverse 1Trim 1
UCase 1