Access Vba Code Examples Download
Programming in Access VBA In this part, you will learn all about how Visual Basic for Applications. So if you have used Access 2003/2007 to design VBA code, you will not find too many differences. For example, the Access application is an object, a query definition is an object, as is a table definition.
Excel /
- Access.; 2 minutes to read Contributors. In this article. Find how-to content, sample code, SDK and API documentation, VBA references, training, and technical articles for developing solutions and customizing Access.
- This section of FreeVBCode provides free code on the topic of Office / VBA. These free Visual Basic code snippets, examples, and articles are available for you to download and review. Convert Access Database to Excel Workbook Convert an Excel column. Download Web Page Hyperlinks and Images from Excel.
- Access.; 2 minutes to read Contributors. In this article. Find how-to content, sample code, SDK and API documentation, VBA references, training, and technical articles for developing solutions and customizing Access.
- Ken's ACCESS VBA Code Examples. Return to Home. Return to Top of Page. Return to Home.
ActiveCell39 | ActiveWorkbook17 |
ActiveWorksheet14 | AdvancedFilter3 |
AutoFill1 | AutoFilter21 |
Binding8 | Cell Comments7 |
Cell Copy1 | Cell Format11 |
Cell Number Format1 | Cell Protected1 |
Cell Reference7 | Cell Value11 |
Cell12 | Cells12 |
Chart Event9 | Chart Export2 |
Chart Format27 | Chart Lengend2 |
Chart Protect2 | Chart Title5 |
Chart36 | Column17 |
ComboBox2 | Copy Paste5 |
Count1 | CountA1 |
Data Refresh1 | Evaluate2 |
Excel to XML1 | Excel ADO5 |
Excel Buildin Function7 | Excel Dialog2 |
Excel Recordset2 | Excel Sort1 |
Excel to Text File3 | Excel Toolbar2 |
Excel Transfer3 | Excel XML12 |
Excel3 | ExecuteExcel4Macro2 |
FormatConditions21 | Formula9 |
Hyperlinks2 | Minute1 |
Month3 | Name Create7 |
Name31 | Page Break9 |
Page Orientation1 | PivotChart1 |
PivotTable11 | Range Add4 |
Range Copy Cut Paste10 | Range Format30 |
Range Intersect2 | Range Loop6 |
Range Name2 | Range Permission3 |
Range Print1 | Range Reference20 |
Range Union4 | Range Value6 |
Range31 | Row Format4 |
Row13 | Selection Format2 |
Selection13 | Shape6 |
Shapes5 | SpecialCells12 |
SUM3 | Text to Excel4 |
Watch1 | Workbook Encryption2 |
Workbook Event24 | Workbook File12 |
Workbook Links3 | Workbook Password3 |
Workbook Permission5 | Workbook Protect4 |
Workbook SaveAs10 | Workbook Share3 |
Workbook Template5 | Workbook26 |
Workbooks32 | Worksheet Add8 |
Worksheet Event33 | Worksheet Export Import3 |
Worksheet Format1 | Worksheet Hide9 |
Worksheet Move4 | Worksheet OnEntry1 |
Worksheet Page Header Footer3 | Worksheet Print Setting2 |
Worksheet Protection9 | Worksheet Sort2 |
Worksheet16 | WorksheetFunction11 |
Worksheets10 |
Access /
Access ADO4 | Access Environment7 |
Access Import Export11 | Access to Excel2 |
Access to Word1 | Access XML4 |
ADO Data Type3 | ADO Error1 |
ADODB Command3 | ADODB.Connection7 |
ADOMD1 | AllTables4 |
Autonumber2 | Column Constraint3 |
Connection String1 | CurrentData3 |
CurrentProject Connection2 | CurrentProject10 |
Database Compact1 | Database Create1 |
Database Encrypt1 | Database File3 |
Database Link3 | Database Password6 |
Database Properties6 | Database Protect3 |
Database Replica2 | Database Transfer7 |
dBASE ADO2 | DBEngine3 |
Group Account15 | Index12 |
Key6 | Lock6 |
Microsoft Jet10 | OLEDB5 |
Oracle1 | Primary Key4 |
Query13 | QueryTable3 |
Recordset Add Update Delete12 | Recordset Bookmark5 |
Recordset Convert1 | Recordset Count2 |
Recordset Cursor20 | Recordset Delete2 |
Recordset Field4 | Recordset Filter7 |
Recordset Find10 | Recordset Open27 |
Recordset Save2 | Recordset Seek3 |
Recordset Sort1 | Recordset Support4 |
Recordset to File2 | Recordset to XML2 |
Recordset Update3 | Recordset22 |
Relationship3 | Report Event9 |
Report5 | Reports2 |
SQL Parameter6 | SQL Select30 |
SQL Table Join1 | SQL Update5 |
SQLServer6 | Stored Procedure7 |
Table Column Field20 | Table Copy1 |
Table Create9 | Table Delete2 |
Table Join2 | Table Output2 |
Table Properties6 | Table Type2 |
Table Update2 | TableDefs7 |
Text ADO1 | Text Transfer2 |
Transaction4 | UsedRange5 |
User Access6 | User Account12 |
View5 | Workspaces13 |
PowerPoint /
ActivePresentation5 | Exchange ADO1 |
PowerPoint Format8 | PowerPoint Slide3 |
PowerPoint3 | Presentations1 |
Slide Edit10 | Slide Export Save12 |
Slide Master7 | Slide Print2 |
Slide Shape8 | Slide Show17 |
Slide Tempalte3 | Slide Text9 |
Slide Transition1 |
Word /
ActiveDocument15 | Document Format2 |
Document Header Footer11 | Document Print2 |
Document Selection4 | Document Table33 |
Document View7 | Documents4 |
Word Bookmark3 | Word Document Print2 |
Word Document10 | Word Format2 |
Word Text3 | Word3 |
Outlook /
Email Attachment2 | Email Send1 |
Email9 | InternetExplorer1 |
MailMerge2 | Outlook Calendar2 |
Outlook Contact6 | Outlook NameSpace17 |
Outlook Table2 | Outlook Task4 |
Outlook2 |
Application /
ActiveInspector4 | ActiveWindow13 |
AddIns2 | Application DoEvent1 |
Application Events4 | Application OnKey6 |
Application OnTime8 | Application SendKeys2 |
Application Windows7 | Application.DisplayAlerts1 |
Application.FileSearch2 | Application40 |
Broken Reference1 | Color Constant9 |
Column Type2 | CommandBar53 |
CreateObject1 | Dialogs7 |
DoCmd18 | Environ1 |
GetObject2 | Immediate Window1 |
Menu32 | Office Permmison7 |
Options13 | References2 |
SearchScopes1 | SmartTag2 |
StatusBar2 | VBE10 |
Windows6 |
Forms /
CheckBox3 | Dir5 |
Find8 | Focus1 |
Form Control10 | Form Events16 |
Form Recordset1 | Form13 |
Forms2 | Image1 |
Label2 | ListBox11 |
Mouse3 | Replace3 |
ScrollBar1 | SpinButton5 |
Spleash Screen1 | TextBox4 |
Windows API /
CPU Processor2 | MDI Sound1 |
OSVERSIONINFO1 | Printer5 |
Registry5 | Screen Resolution2 |
Shell6 | Sound2 |
System Memory1 | SYSTEM_INFO1 |
Wav Sound2 | Win32 API1 |
Window Installation4 | Windows API5 |
Windows Resources18 | Windows User2 |
XML /
DOMDocument5 | XML Data5 |
XML Export2 | XML Transformed1 |
XmlMap2 |
Data Type /
Array Erase2 | Array Function4 |
Array Sort5 | Array27 |
Boolean5 | Byte2 |
Collection14 | Currency Format3 |
Data Type3 | Date Type7 |
Double3 | Enum3 |
Int3 | Integer9 |
IS1 | Long2 |
Multidimensional Arrays2 | Null3 |
Object Variable Set12 | OLE Equation1 |
OLE Objects1 | OLEObject1 |
Single3 | String Function15 |
String6 | Time3 |
Type Mismatch1 | Type4 |
TypeName7 | Val3 |
Variant11 | varType4 |
Data Type Functions /
CBool1 | CByte1 |
CCur2 | CDate1 |
CDbl1 | CDec1 |
Char3 | ChDir1 |
ChDrive1 | Chr2 |
CInt2 | Class9 |
CLng1 | CSng2 |
CStr1 | CVar1 |
Data Type Convert5 | Format9 |
FormatCurrency1 | FormatDateTime1 |
FormatNumber1 | FormatPercent1 |
IsArray2 | IsEmpty3 |
IsNull3 | IsNumeric2 |
LBound UBound2 |
Language Basics /
ActiveForm1 | ByVal ByRef4 |
Call3 | Comparison Operators4 |
Compiler Directive4 | Conditional Compilation1 |
Const9 | Debug.Assert2 |
Debug.Print2 | Do Until5 |
Do While10 | Error Handler11 |
Error18 | Exit3 |
For Each6 | For11 |
Function Parameter19 | Function Return7 |
Function11 | GoTo4 |
IF18 | IIF4 |
InputBox20 | Logical Operators6 |
Mathematical Operators2 | MsgBox30 |
Optional Arguments1 | ParamArray1 |
Recursive3 | Resume3 |
Select13 | Static variable4 |
Sub14 | Variable Declaration6 |
Variable Scope10 | Variable Type5 |
Variable3 | While1 |
With3 |
File Path /
Binary File2 | CSV6 |
CurDir3 | Drive10 |
File Name2 | File Read Write2 |
File9 | FileDateTime5 |
FileDialog10 | FileLen1 |
FileSearch9 | FileSystemObject6 |
FileTypes1 | Folder Dialog1 |
Folder2 | FreeFile8 |
GetOpenFilename5 | Image Object1 |
Kill2 | ListObject3 |
Path3 | Print to File1 |
Random Access Files3 | SearchFolders1 |
Sequential Access Files3 | Text File8 |
TextStream3 | WinHttpRequest1 |
Date Functions /
Currency Type2 | Date Format49 |
Date2 | DateAdd3 |
DateDiff9 | DatePart15 |
DateSerial4 | DateValue3 |
Day2 | Dynamic Array8 |
Hour2 | MonthName4 |
Now3 | Number Format15 |
Second1 | Timer Function1 |
TimeSerial3 | TimeValue6 |
Weekday5 | WeekdayName3 |
Year2 |
Math Functions /
Abs2 | Atn2 |
Cos2 | Exp2 |
Fix4 | Log2 |
Rnd3 | Sgn4 |
Sin2 | Sqr2 |
Tan2 |
String Functions /
Asc1 | InStr1 |
ISLIKE1 | LCase1 |
Left2 | len3 |
Like2 | Mid2 |
Right2 | Space1 |
Str2 | StrComp2 |
StrConv8 | String Replace1 |
StrReverse1 | Trim1 |
UCase1 |
Unhide All Rows and Columns
This macro code will unhide all the hidden rows and columns.
This could be really helpful if you get a file from someone else and want to be sure there are no hidden rows/columns.
Unmerge All Merged Cells
It's a common practice to merge cells to make it one. While it does the work, when cells are merged you will not be able to sort the data.
In case you are working with a worksheet with merged cells, use the code below to unmerge all the merged cells at one go.
Note that instead of Merge and Center, I recommend using Centre Across Selection option.
Save Workbook With TimeStamp in Its Name
A lot of time, you may need to create versions of your work. These are quite helpful in long projects where you work with a file over time.
A good practice is to save the file with timestamps.
Using timestamps will allow you to go back to a certain file to see what changes were made or what data was used.
Here is the code that will automatically save the workbook in the specified folder and add a timestamp whenever it's saved.
You need to specify the folder location and the file name.
In the above code, 'C:UsersUsernameDesktop is the folder location I have used. You need to specify the folder location where you want to save the file. Also, I have used a generic name 'WorkbookName' as the filename prefix. You can specify something related to your project or company.
Save Each Worksheet as a Separate PDF
If you work with data for different years or divisions or products, you may have the need to save different worksheets as PDF files.
Microsoft Access Vba Code Examples
While it could be a time-consuming process if done manually, VBA can really speed it up.
Here is a VBA code that will save each worksheet as a separate PDF.
In the above code, I have specified the address of the folder location in which I want to save the PDFs. Also, each PDF will get the same name as that of the worksheet. You will have to modify this folder location (unless your name is also Sumit and you're saving it in a test folder on the desktop).
Ms Access Vba Code Download
Note that this code works for worksheets only (and not chart sheets).