AutoMacro has been used by employees of these organizations. These organizations do not endorse, approve, sponsor, or otherwise have any affiliation with this website, Spreadsheet Boot Camp LLC, or ToolFive Software LLC.
About the Add-in
Our free VBA add-in installs directly into the VBA Editor (see above).
It contains 150 ready-to-use VBA Macro code examples for Excel. Simply click your desired code example and it will insert directly into your module:
Download
Click the download button to download our free VBA add-in for Excel!
Important! Read the Walkthrough below. It contains important information.
Walkthrough
The macro code examples add-in was designed entirely with VBA. This can be convenient because you don’t need to install anything, but VBA has limitations. As a result of these limitations, the add-in will stop functioning periodically (note: this happens when VBA «loses focus», often as a result of code errors).
To help, we built in a «reset» button:
To activate the reset, go to Excel and click the AutomateExcel.com Ribbon > Restore VBA Add-in.
If you find the add-in useful, you’ll love our premium VBA add-in (more information below). The premium add-in is not built with VBA and doesn’t require any resets. It has many more (better organized) code fragments, VBA code generators, the ability to save your own code, and much more….
Installation
1. Download the file above
2. Follow these directions to install an Excel Add-in.
3. If you encounter an error «Trust access to the VBA project object model is disabled» then you must update the following settings
VBA Add-in FAQs
How to download VBA For Excel?
All versions of Excel already come with VBA installed. Use shortcut ALT + F11 to open the VBA Editor.
How to install Excel Add-ins?
Make sure the Developer Ribbon is installed. Then go to Developer > Excel Add-ins > Browse to select and install your add-in.
What is the VBA Code Examples Add-in?
The VBA Code examples add-in is a free add-in for Excel / VBA that comes with 150+ ready-to-use VBA code examples & macros.
AutoMacro — The Ultimate VBA Add-in
AutoMacro is an add-in that installs directly into the Visual Basic Editor:
The add-in comes loaded with code generators, hundreds of macro code examples, the ability to create your own code library, and other time-saving tools.
Join the Hundreds of Professionals Who Use AutoMacro
«I use it almost every day. A great tool for getting things done, but also a great tool for learning how to do things! This is one purchase this year I have no regrets about.»
Galen — USA
AutoMacro Features
Code Generators
Code Generators build code from scratch via visual interfaces!
Code Library
300 Ready-to-use code examples & VBA macros.
Save your own frequently used code and share with team members.
Coding Tools
VBA Coding tools to improve the out of date Visual Basic Editor.
Speed up your workflow with tools to navigate, debug, format and more.
VBA Tutorial
Our premium VBA add-in contains a free VBA tutorial.
Just download AutoMacro and you’ll have access to the tutorial.
Beginner
1 User — 1 PC
- Interactive VBA Tutorial
- 100+ ready-to-use code examples
- Procedure, Loops, & Copy Paste Builders
- All other code generators
- Coding tools
- Create your own code library
- Transfer Activations to other PCs
- Access to new features & updates
One-time fee
Click for Alternative Payment Options
Upgrade Anytime!
Developer
1 User — 3 PCs
- Interactive VBA Tutorial
- Hundreds of ready-to-use code examples
- Procedure, Loops, & Copy Paste Builders
- All other code generators
- Coding tools
- Create your own code library
- Transfer Activations to other PCs
- Access to new features & updates
One-time fee
Click for Alternative Payment Options
Upgrade Anytime!
Developer+
1 User — 3 Transferable PCs & Updates
- Interactive VBA Tutorial
- Hundreds of ready-to-use code examples
- Procedure, Loops, & Copy Paste Builders
- All other code generators
- Coding tools
- Create your own code library
- Transfer activations to other PCs
- Access to new features & updates
One-time fee + $20 Annual
Click for Alternative Payment Options
Customer Reviews
FAQ and Other Information
What is your refund policy?
We have a 30-day, no-questions-asked, 100% money-back guarantee. If you’re unsatisfied for any reason, let us know and we will refund your order!
Can I try AutoMacro before I buy?
Can I install AutoMacro on my Work Computer?
Yes! AutoMacro works in many corporate environments. It was designed to be as unobtrusive as possible and should install without the need for «admin privileges».
Will AutoMacro work on my system?
AutoMacro is compatible with all versions of Microsoft Office for PCs.
32-bit or 64-bit
Office 2003, 2007, 2010, 2013, 2016, 2019, Office 365, etc.
All Versions of Windows
Surface Pro
AutoMacro is not compatible with Mac operating systems. However, some Mac users running Windows OS are able to use AutoMacro.
If you have doubts, please try the download link above to check.
AutoMacro is not compatible with Citrix environments.
Can I deduct this purchase on my taxes?
See this page from the IRS on Employee Business Expenses.
Can I use on more than one computer?
The Beginner version entitles you to a single-use license code valid for 1 computer. The Developer version is valid for 3 computers. The Developer+ allows you to transfer activations between PCs, so that AutoMacro can be activated on any 3 PCs at one time.
Does AutoMacro work with PowerPoint, Word, or Access?
Yes! AutoMacro functions in any program with the Visual Basic Editor.
Specific code examples were developed for Excel, Access, Outlook, Word, and PowerPoint.
Visit AutoMacro’s FAQ Page
Join the Hundreds of Professionals Who Use AutoMacro
«Great product, haven’t stopped using it since I purchased it. It doesn’t just write your code, it teaches as you go!»
Tony D — United Kingdom
Steve Rynearson:
Creator of AutoMacro
Over the years, I’ve spent countless hours searching online for example code and adapting that code to my needs.
I often found myself clicking the same links and copying the same code. I thought there has to be a better way!
AutoMacro is the ultimate VBA Code Helper! It eliminates much of the need to search online for code. Instead simply use the menus to select pre-built code or use the builders to generate code for your exact needs.
Additionally, the coding tools will save you time and help you develop more professional looking code.
For anyone coding VBA, AutoMacro is a life-saver. You’ll code much faster, develop more professional code, and learn VBA much faster (if you’re not already an expert).
stdVBA
A Collection of libraries to form a common standard layer for modern VBA applications.
Benefits
- Code faster!
- Improve code maintainability.
- Let the library handle the complicated stuff, you focus on the process
- Heavily inspired by JavaScript APIs — More standard
- Open Source — Means the libraries are continually maintained by the community. Want something added, help us make it!
The full roadmap has more detailed information than here.
Short example
sub Main() 'Create an array Dim arr as stdArray set arr = stdArray.Create(1,2,3,4,5,6,7,8,9,10) 'Can also call CreateFromArray 'Demonstrating join, join will be used in most of the below functions Debug.Print arr.join() '1,2,3,4,5,6,7,8,9,10 Debug.Print arr.join("|") '1|2|3|4|5|6|7|8|9|10 'Basic operations arr.push 3 Debug.Print arr.join() '1,2,3,4,5,6,7,8,9,10,3 Debug.Print arr.pop() '3 Debug.Print arr.join() '1,2,3,4,5,6,7,8,9,10 Debug.Print arr.concat(stdArray.Create(11,12,13)).join '1,2,3,4,5,6,7,8,9,10,11,12,13 Debug.Print arr.join() '1,2,3,4,5,6,7,8,9,10 'concat doesn't mutate object Debug.Print arr.includes(3) 'True Debug.Print arr.includes(34) 'False 'More advanced behaviour when including callbacks! And VBA Lamdas!! Debug.Print arr.Map(stdLambda.Create("$1+1")).join '2,3,4,5,6,7,8,9,10,11 Debug.Print arr.Reduce(stdLambda.Create("$1+$2")) '55 ' I.E. Calculate the sum Debug.Print arr.Reduce(stdLambda.Create("application.worksheetFunction.Max($1,$2)")) '10 ' I.E. Calculate the maximum Debug.Print arr.Filter(stdLambda.Create("$1>=5")).join '5,6,7,8,9,10 'Execute property accessors with Lambda syntax Debug.Print arr.Map(stdLambda.Create("ThisWorkbook.Sheets($1)")) _ .Map(stdLambda.Create("$1.Name")).join(",") 'Sheet1,Sheet2,Sheet3,...,Sheet10 'Execute methods with lambdas and enumerate over enumeratable collections: Call stdEnumerator.Create(Application.Workbooks).forEach(stdLambda.Create("$1.Save") 'We even have if statement! With stdLambda.Create("if $1 then ""lisa"" else ""bart""") Debug.Print .Run(true) 'lisa Debug.Print .Run(false) 'bart End With 'Execute custom functions Debug.Print arr.Map(stdCallback.CreateFromModule("ModuleMain","CalcArea")).join '3.14159,12.56636,28.274309999999996,50.26544,78.53975,113.09723999999999,153.93791,201.06176,254.46879,314.159 'Let's move onto regex: Dim oRegex as stdRegex set oRegex = stdRegex.Create("(?<county>[A-Z])-(?<city>d+)-(?<street>d+)","i") Dim oRegResult as object set oRegResult = oRegex.Match("D-040-1425") Debug.Print oRegResult("county") 'D Debug.Print oRegResult("city") '040 'And getting all the matches.... Dim sHaystack as string: sHaystack = "D-040-1425;D-029-0055;A-100-1351" Debug.Print stdEnumerator.CreateFromIEnumVARIANT(oRegex.MatchAll(sHaystack)).map(stdLambda.Create("$1.item(""county"")")).join 'D,D,A 'Dump regex matches to range: ' D,040,040-1425 ' D,029,029-0055 ' A,100,100-1351 Range("A3:C6").value = oRegex.ListArr(sHaystack, Array("$county","$city","$city-$street")) 'Copy some data to the clipboard: Range("A1").value = "Hello there" Range("A1").copy Debug.Print stdClipboard.Text 'Hello there stdClipboard.Text = "Hello world" Debug.Print stdClipboard.Text 'Hello world 'Copy files to the clipboard. Dim files as collection set files = new collection files.add "C:File1.txt" files.add "C:File2.txt" set stdClipboard.files = files 'Save a chart as a file Sheets("Sheet1").ChartObjects(1).copy Call stdClipboard.Picture.saveAsFile("C:test.bmp",false,null) 'Use IPicture interface to save to disk as image End Sub Public Function CalcArea(ByVal radius as Double) as Double CalcArea = 3.14159*radius*radius End Function
Motivation
VBA first appeared in 1993 (over 25 years ago) and the language’s age is definitely noticable. VBA has a lot of specific libraries for controlling Word, Excel, Powerpoint etc. However the language massively lacks in generic modern libraries for accomplishing common programming tasks. VBA projects ultimately become a mish mash of many different technologies and programming styles. Commonly for me that means calls to Win32 DLLs, COM libraries via late-binding, calls to command line applications and calls to .NET assemblies.
Over time I have been building my own libraries and have gradually built my own layer above the simple VBA APIs.
The VBA Standard Library aims to give users a set of common libraries, maintained by the community, which aid in the building of VBA Applications.
Road Map
This project is has been majorly maintained by 1 person, so progress is generally very slow. This said, generally the road map corresponds with what I need at the time, or what irritates me. In general this means fundamental
features are more likely to be complete first, more complex features will be integrated towards the end. This is not a rule, i.e. stdSharepoint
is mostly complete without implementation of stdXML
which it’d use. But as a general rule of thumb things will be implemented in the following order:
- Types —
stdArray
,stdDictionary
,stdRegex
,stdDate
,stdLambda
, … - Data —
stdJSON
,stdXML
,stdOXML
,stdCSON
,stdIni
,stdZip
- File —
stdShell
- Automation —
stdHTTP
,stdAcc
,stdWindow
,stdKernel
- Excel specific —
xlFileWatcher
,xlProjectBuilder
,xlTimer
,xlShapeEvents
,xlTable
- Runtimes —
stdCLR
,stdPowershell
,stdJavascript
,stdOfficeJSBridge
As an indicator of where my focuses have been in the past year, take a look at the following heat map:
Planned Global Objects:
Color | Status | Type | Name | Docs | Description |
---|---|---|---|---|---|
HOLD | Debug | stdError | None | Better error handling, including stack trace and error handling diversion and events. | |
READY | Type | stdArray | None | A library designed to re-create the Javascript dynamic array object. | |
READY | Type | stdEnumerator | docs | A library designed to wrap enumerable objects providing additional functionality. | |
WIP | Type | stdDictionary | None | A drop in replacement for VBScript’s dictionary. | |
READY | Type | stdDate | None | A standard date parsing library. No more will you have to rely on Excel’s interpreter. State the format, get the data. | |
READY | Type | stdRegex | None | A regex library with more features than standard e.g. named capture groups and free-spaces. | |
READY | Type | stdLambda | docs | Build and create in-line functions. Execute them at a later stage. | |
READY | Type | stdCallback | None | Link to existing functions defined in VBA code, call them at a later stage. | |
READY | Type | stdCOM | None | A wrapper around a COM object which provides Reflection (through ITypeInfo), Interface querying, Calling interface methods (via DispID) and more. | |
READY | Automation | stdClipboard | None | Clipboard management library. Set text, files, images and more to the clipboard. | |
HOLD | Automation | stdHTTP | None | A wrapper around Win HTTP libraries. | |
READY | Automation | stdWindow | docs | A handy wrapper around Win32 Window management APIs. | |
READY | Automation | stdProcess | None | Create and manage processes. | |
READY | Automation | stdAcc | docs | Use Microsoft Active Accessibility framework within VBA — Very useful for automation. | |
READY | Automation | stdWebSocket | None | WebSocket automation. Currently uses IE, need to move to more stable runtime. Will be useful for modern automation e.g. chrome | |
WIP | Excel | xlTable | None | Better tables for VBA, e.g. Map rows etc. | |
READY | DevTools | stdPerformance | None | Performance testing |
The full roadmap has more detailed information than here.
Statuses
READY
APIs which are ready to use, and although are not fully featured are in a good enough working state.
WIP
APIs which are WIP are not necessarily being worked on currently but at least are recognised for their importance to the library. These will be lightly worked on/thought about continuously even if no commits are made.
As of Oct 2020, this status typically consists of:
- data types, e.g. stdEnumerator, stdDictionary, stdTable;
- Unit testing;
- Tasks difficult to automate otherwise e.g. stdClipboard, stdAccessibility;
HOLD
APIs where progress has been temporarily halted, and/or is currently not a priority.
In the early days we’ll see this more with things which do already have existing work arounds and are not critical, so projects are more likely to fit into this category.
UNK
APIs which have been indefinitely halted. We aren’t sure whether we need these or if they really fit into the project. They are nice to haves but not necessities for the project as current. These ideas may be picked up later. All feature requests will fit into this category initially.
Structure
All modules or classes will be prefixed by std
if they are generic libraries.
Application specific libraries to be prefixed with xl
, wd
, pp
, ax
representing their specific application.
Commonly implementations will use the factory class design pattern:
Class stdClass Private bInitialised as boolean 'Creates an object from the given parameters '@constructor Public Function Create(...) As stdClass if not bInitialised then Set Create = New stdClass Call Create.init(...) else Call CriticalRaise("Constructor called on object not class") End If End Function 'Initialises the class. This method is meant for internal use only. Use at your own risk. '@protected Public Sub init(...) If bInitialised Then Call CriticalRaise("Cannot run init() on initialised object") elseif Me is stdClass then Call CriticalRaise("Cannot run init() on static class") else 'initialise with params... 'Make sure bInitialised is set bInitialised=true End If End Sub Private Sub CriticalRaise(ByVal sMsg as string) if isObject(stdError) then stdError.Raise sMsg else Err.Raise 1, "stdClass", sMsg end if End Sub '... End Class
With the above example, the Regex class is constructed with the Create()
method, which can only be called on the stdRegex
static class. We will try to keep this structure across all STD VBA classes.
Contributing
If you are looking to contribute to the VBA standard library codebase, the best place to start is the GitHub «issues» tab. This is also a great place for filing bug reports and making suggestions for ways in which we can improve the code and documentation. A list of options of different ways to contribute are listed below:
- If you have a Feature Request — Create a new issue
- If you have found a bug — Create a new issue
- If you have written some code which you want to contribute see the Contributing Code section below.
Contributing Code
There are several ways to contribute code to the project:
- Opening pull requests is the easiest way to get code intergrated with the standard library.
- Create a new issue and providing the code in a code block — Bare in mind, it will take us a lot longer to pick this up than a standard pull request.
Please make sure code contributions follow the following guidelines:
stdMyClass.cls
should haveAttribute VB_PredeclaredId = True
.Attribute VB_Name
should follow the STD convention e.g."stdMyClass"
- Follow the STD constructor convention
stdMyClass.Create(...)
. - Ensure there are plenty of comments where required.
- Ensure lines end in
rn
and notn
only.
As long as these standard conventions are met, the rest is up to you! Just try to be as general as possible! We’re not necessarily looking for optimised code, at the moment we’re just looking for code that works!
Note: Ensure that all code is written by you. If the code is not written by you, you will be responsible for any repercussions!
Inspiration documents
Inspiration was initially stored in this repository, however the vast swathes of examples, knowledge and data became too big for this repository, therefore it was moved to:
https://github.com/sancarn/VBA-STD-Lib-Inspiration
VBA Libraries
Libraries are used to access functionality outside of what VBA can do on its own. There are a number of VBA libraries provided by the Windows operating system, Office applications, and other software installed by the user. Libraries are often used to control a specific application or access classes which serve specific purposes. Libraries can be used to write VBA programs that utilize multiple applications, access the user’s file system, manipulate text files and databases, get information from the internet, and more.
Set Library References
Setting a reference to a library allows a VBA project to access the members of the library directly. Setting a reference allows the VBA compiler and the Visual Basic Editor to see the members of a library. Setting a reference allows for early-binding of object variables, enables intellisense, and makes the library visible in the Object Browser. To set a reference to a library navigate to Tools → References in the Visual Basic Editor and check the library and click Ok. Members of a library can be accessed without a reference by using late-binding (declaring an object variable with the generic Object type and using the CreateObject function with the class’s ProgID). Early-binding vs late-binding is discussed in the Objects section.
Fully Qualified Identifiers
When using libraries, be sure to use the fully qualified names for classes, variables, and procedures to avoid naming collisions. There are times when a library contains an identifier that is the same as another identifier in VBA or another library. If the name is not fully qualified, VBA will not know which identifier is being referred to and errors can occur. To fully qualify an identifier’s name include the library of origin.
Public Sub Example()
'References set to Excel object library and Word object library
Dim ExcelApp As Excel.Application
Dim WordApp As Word.Application
Set ExcelApp = Excel.Application
Set WordApp = Word.Application
End Sub
Exploring Libraries
To explore the contents of a library in detail set a reference to the library and use the Object Browser to view the library’s members.
Search and Browse Specific Libraries
Specific libraries can be browsed and searched by selecting the library from the library drop-down.
View Class Members
Select an item in the Classes section and view its members in the Members section.
Search
Use the search bar to search for specific text related to a class or member. Select an item in the Search Results to view its members in the members section.
Important Libraries
There are a number of important libraries which are very commonly used and are often necessary for accomplishing tasks in VBA.
Name: | Scripting |
---|---|
Description: | Microsoft Scripting Runtime |
FullPath: | C:WindowsSystem32scrrun.dll |
GUID: | {420B2830-E718-11CF-893D-00A0C9054228} |
Use Cases: | File System, Text Files, Dictionary Class |
Name: | ADODB |
---|---|
Description: | Microsoft ActiveX Data Objects 6.1 Library |
FullPath: | C:Program FilesCommon FilesSystemadomsado15.dll |
GUID: | {B691E011-1797-432E-907A-4D8C69339129} |
Use Cases: | Databases, Text Files |
Name: | MSHTML |
---|---|
Description: | Microsoft HTML Object Library |
FullPath: | C:WindowsSystem32mshtml.tlb |
GUID: | {3050F1C5-98B5-11CF-BB82-00AA00BDCE0B} |
Use Cases: | HTML, DOM |
Name: | SHDocVw |
---|---|
Description: | Microsoft Internet Controls |
FullPath: | C:WindowsSystem32ieframe.dll |
GUID: | {EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B} |
Use Cases: | IE Automation |
Name: | WinHttp |
---|---|
Description: | Microsoft WinHTTP Services, version 5.1 |
FullPath: | C:Windowssystem32winhttpcom.dll |
GUID: | {662901FC-6951-4854-9EB2-D9A2570F2B2E} |
Use Cases: | HTTP Requests |
Name: | MSXML2 |
---|---|
Description: | Microsoft XML, v3.0 | v6.0 |
FullPath: | C:WindowsSystem32msxml3.dll | C:WindowsSystem32msxml6.dll |
GUID: | {F5078F18-C551-11D3-89B9-0000F81FE221} |
Use Cases: | XML, HTTP Requests |
Name: | Shell32 |
---|---|
Description: | Microsoft Shell Controls And Automation |
FullPath: | C:WindowsSysWOW64shell32.dll |
GUID: | {50A7E9B0-70EF-11D1-B75A-00A0C90564FE} |
Use Cases: | Shell, Zip Files, File System |
Name: | IWshRuntimeLibrary |
---|---|
Description: | Windows Script Host Object Model |
FullPath: | C:WindowsSystem32wshom.ocx |
GUID: | {F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} |
Use Cases: | Shell, Shortcuts, File System, Network, Registry |
Name: | VBScript_RegExp_55 |
---|---|
Description: | Microsoft VBScript Regular Expressions 5.5 |
FullPath: | C:WindowsSystem32vbscript.dll3 |
GUID: | {3F4DACA7-160D-11D2-A8E9-00104B365C9F} |
Use Cases: | Regular Expressions |
Name: | VBIDE |
---|---|
Description: | Microsoft Visual Basic for Applications Extensibility 5.3 |
FullPath: | C:Program Files (x86)Common FilesMicrosoft SharedVBAVBA6VBE6EXT.OLB |
GUID: | {0002E157-0000-0000-C000-000000000046} |
Use Cases: | Visual Basic Editor, Project References |
Name: | mscorlib |
---|---|
Description: | mscorlib.dll |
FullPath: | C:WindowsMicrosoft.NETFramework64v4.0.30319mscorlib.tlb |
GUID: | {BED7F4EA-1A96-11D2-8F08-00A0C9A6186D} |
Use Cases: | ArrayList |
Microsoft Office Applications
To work with more than one Office application in a single VBA program it is helpful to set references to all Office applications being used.
Name: | Access |
---|---|
Description: | Microsoft Access 16.0 Object Library |
FullPath | C:Program FilesMicrosoft OfficerootOffice16MSACC.OLB |
GUID: | {4AFFC9A0-5F99-101B-AF4E-00AA003F0F07} |
Name: | Excel |
---|---|
Description: | Microsoft Excel 16.0 Object Library |
FullPath | C:Program FilesMicrosoft OfficerootOffice16EXCEL.EXE |
GUID: | {00020813-0000-0000-C000-000000000046} |
Name: | Outlook |
---|---|
Description: | Microsoft Outlook 16.0 Object Library |
FullPath | C:Program FilesMicrosoft OfficerootOffice16MSOUTL.OLB |
GUID: | {00062FFF-0000-0000-C000-000000000046} |
Name: | PowerPoint |
---|---|
Description: | Microsoft PowerPoint 16.0 Object Library |
FullPath | C:Program FilesMicrosoft OfficerootOffice16MSPPT.OLB |
GUID: | {91493440-5A91-11CF-8700-00AA0060263B} |
Name: | Publisher |
---|---|
Description: | Microsoft Publisher 16.0 Object Library |
FullPath | C:Program FilesMicrosoft OfficerootOffice16MSPUB.TLB |
GUID: | {0002123C-0000-0000-C000-000000000046} |
Name: | Word |
---|---|
Description: | Microsoft Word 16.0 Object Library |
FullPath | C:Program FilesMicrosoft OfficerootOffice16MSWORD.OLB |
GUID: | {00020905-0000-0000-C000-000000000046} |
Name: | Visio |
---|---|
Description: | Microsoft Visio 16.0 Type Library |
FullPath | C:Program FilesMicrosoft OfficerootOffice16VISLIB.DLL |
GUID: | {00021A98-0000-0000-C000-000000000046} |
Adobe Acrobat
The Adobe Acrobat Library can be used to automate the Adobe Acrobat application and work with PDF files. Adobe Acrobat must be purchased from Adobe and installed in order for the VBA libraries to be available.
Name: | Acrobat |
---|---|
Description: | Adobe Acrobat 10.0 Type Library |
FullPath: | C:Program Files (x86)AdobeAcrobat 2017Acrobatacrobat.tlb |
GUID: | {E64169B3-3592-47D2-816E-602C5C13F328} |
Name: | AFORMAUTLib |
---|---|
Description: | AFormAut 1.0 Type Library |
FullPath: | C:Program Files (x86)AdobeAcrobat Reader DCReaderplug_insAcroForm.api |
GUID: | {7CD06992-50AA-11D1-B8F0-00A0C9259304} |
Micro Focus Reflection
The Micro Focus Reflection libraries can be used to automate tasks in the Micro Focus Reflection application. Micro Focus Reflection Desktop 16.1 must be purchased and installed in order for the libraries to be available.
Name: | Attachmate_Reflection_Objects |
---|---|
Description: | C:Program Files (x86)Micro FocusReflectionAttachmate.Reflection.Objects.tlb |
GUID: | {6857A7F4-4CDE-43F2-A7B1-CB18BA8AA35F} |
Name: | Attachmate_Reflection_Objects_Emulation_IbmHosts |
---|---|
Description: | C:Program Files (x86)Micro FocusReflectionAttachmate.Reflection.Objects.Emulation.IbmHosts.tlb |
GUID: | {0D5D17DF-B511-4BE5-9CD0-10DE1385229D} |
Name: | Attachmate_Reflection_Objects_Emulation_OpenSystems |
---|---|
Description: | C:Program Files (x86)Micro FocusReflectionAttachmate.Reflection.Objects.Emulation.OpenSystems.tlb |
GUID: | {3BA4C5BF-F24A-4BE4-8BAB-8BD78C2FABDE} |
Name: | Attachmate_Reflection_Objects_Framework |
---|---|
Description: | C:Program Files (x86)Micro FocusReflectionAttachmate.Reflection.Objects.Framework.tlb |
GUID: | {88EC0C50-0C86-4679-B27D-63B2FCF1C6F4} |
Programmatically Work With Project References
To programmatically work with project references use the Microsoft Visual Basic for Applications Extensibility 5.3 Library (VBIDE).
'In Immediate Window:
?SetProjectReferenceByFilePath("C:WindowsSystem32scrrun.dll")
PrintProjectReferences ThisWorkbook.VBProject
Option Explicit
Public Sub SetProjectReferenceByFilePath(FilePath As String)
'Sets Project Reference
Dim VBProj As Object 'VBIDE.VBProject
Dim Refs As Object 'VBIDE.References
Dim Ref As Object 'VBIDE.Reference
Dim RefFound As Boolean
Set VBProj = ThisWorkbook.VBProject
Set Refs = VBProj.References
For Each Ref In Refs
If Ref.FullPath = FilePath Then
RefFound = True
Exit For
End If
Next Ref
If Not RefFound Then
VBProj.References.AddFromFile FilePath
End If
End Sub
Public Sub PrintProjectReferences(Proj As Object)
'Proj As VBIDE.VBProject
Dim Ref As Object 'VBIDE.Reference
For Each Ref In Proj.References
With Ref
Debug.Print "'''''''''''''''''''''''''''''''''''''''''''''''''"
Debug.Print "Name: " & .Name
Debug.Print "Major Version: " & .Major
Debug.Print "Minor Version: " & .Minor
Debug.Print "Description: " & .Description
Debug.Print "FullPath: " & .FullPath
Debug.Print "GUID: " & .GUID
Debug.Print "Builtin: " & .BuiltIn
Debug.Print "Type: " & .Type
Debug.Print "'''''''''''''''''''''''''''''''''''''''''''''''''"
End With
Next Ref
End Sub
Функция FilenamesCollection предназначена для получения списка файлов из папки, с учётом выбранной глубины поиска в подпапках. Используется рекурсивный перебор папок, до заданного уровня вложенности. К статье прикреплено 2 примера файла с макросами на основе этой функции:
Надстройка samradDatePicker (русифицированная) для облегчения ввода даты в ячейки листа Excel. Добавляет в контекстное меня ячеек пункт выбора даты, а при выделении ячеек, содержащих дату, справа от ячейки отображает значок календаря. Поместите файл надстройки из вложения в папку автозагрузки Excel (C:Program FilesMicrosoft OfficeOFFICExxXLSTART). В контекстном меню ячеек появляется новый пункт — «Выбрать дату из календаря«.
Требуется макросом поместить изображение (картинку) на лист Excel? Используйте функцию ВставитьКартинку, которая позволит вам вставить картинку в выбранную ячейку (или диапазон ячеек). При вызове функции можно задать дополнительные дополнительные параметры, указав, следует ли подгонять картинку (или ячейку) по высоте и ширине. В этом примере демонстрируются возможные варианты применения функции вставки картинок:
макрос удалит на листе все строки, в которых содержится искомый текст: (пример — во вложении ConditionalRowsDeleting.xls) Sub УдалениеСтрокПоУсловию() Dim ra As Range, delra As Range, ТекстДляПоиска As String Application.ScreenUpdating = False ' отключаем обновление экрана ТекстДляПоиска = "Наименование ценности" ' удаляем строки с таким текстом ' перебираем все строки в используемом диапазоне листа For Each ra In ActiveSheet.UsedRange.Rows
Функции GetFileName и GetFilePath по сути аналогичны, и предназначены для вывода диалогового окна выбора файла Функция GetFilenamesCollection позволяет выборать сразу несколько файлов в одной папке. Функция GetFolderPath работает также, только служит для вывода диалогового окна выбора папки.
|
EXCELTools VBA
Установочный файл надстройки — EXCEL Tools VBA
Excel Tools VBA – надстройка, дополняющая MS Excel уникальными инструментами, которая позволяет автоматизировать рутинные и монотонные операции в MS Excel
Основные функции:
- 42 пользовательские функции
- 54 различных инструмента для работы с книгой MS Excel
- инструменты для работы с листами активной книги
- инструменты для выполнения операций над ячейками листа
- прочие инструменты
ПЕРЕЙТИ К ДОКУМЕНТАЦИИ
ПОДЕЛИТЬСЯ ССЫЛКОЙ НА НАДСТРОЙКУ
Version: 3.6 от 20.11.2021
MACROTools VBA Excel
Установочный файл надстройки – MACRO Tools VBA
Инструмент автоматизации разработки макросов в редакторе VBE MS Excel
Основные функции:
- удаление паролей с проектов VBA, книг и листов Excel
- автоматическое форматирование кода, расстановка и удаление отступов в коде
- автоматическая нумерации строк кода
- микро подстройка элементов в формах
ПЕРЕЙТИ К ДОКУМЕНТАЦИИ
ПОДЕЛИТЬСЯ ССЫЛКОЙ НА НАДСТРОЙКУ
Version: 1.9 от 09.02.2022
MACROTools VBA Word
Установочный файл надстройки – MACRO Tools VBA
Инструмент автоматизации разработки макросов в редакторе VBE MS Word
Основные функции:
- удаление паролей с проектов VBA, документов Word
- автоматическое форматирование кода, расстановка и удаление отступов в коде
- автоматическая нумерации строк кода
- микро подстройка элементов в формах
ПЕРЕЙТИ К ДОКУМЕНТАЦИИ
ПОДЕЛИТЬСЯ ССЫЛКОЙ НА НАДСТРОЙКУ
Version: 1.8.3 от 09.02.2022
WORDTools VBA
Установочный файл надстройки — WORD Tools VBA
Надстройка автоматизации рутинных и монотонных операций в MS WORD
Основные функции:
- вставка прописью чисел различных форматов: финансовый, процентный, штуки
- вставка дат прописью на основе календаря
- вставка времени прописью
- авто форматирование текста на основе пользовательских настроек
ПЕРЕЙТИ К ДОКУМЕНТАЦИИ
ПОДЕЛИТЬСЯ ССЫЛКОЙ НА НАДСТРОЙКУ
Version: 1.5 от 09.02.2022
IMAGETools VBA
Установочный файл надстройки — IMAGE Tools VBA
Image Tools VBA — надстройка для импорта иконок, MS Office на листы Excel и получения их названия, содержит 7842 иконки для MS Office 2013 или более поздних версий Excel.
Основные функции:
- алфавитная галерея выбора иконок
- вставка иконки на лист книги Excel, в формате png
- использование название иконки для кода VBA
ПЕРЕЙТИ К ДОКУМЕНТАЦИИ
ПОДЕЛИТЬСЯ ССЫЛКОЙ НА НАДСТРОЙКУ
Version: 1.2 от 11.08.2020
STYLETools VBA
Установочный файл надстройки — STYLETools VBA
Надстройка автоматизации рутинных и монотонных операций по созданию презентаций на основе файлов Excel
Основные функции:
- автоматизация создания презентаций на основе файлов Excel
- настройка дополнительной пользовательской палитры
- инструмент пипетка для копирования цветов
Новая надстройка!
ПОДЕЛИТЬСЯ ССЫЛКОЙ НА НАДСТРОЙКУ
Version: 1.0
Каждый из нас хоть раз работал в программе Excel из пакета Microsoft Office. Изначально, особенно при первичном знакомстве, утилита Excel может показаться очень сложной, с массой каких-то нюансов и тонкостей. Но стоит хоть немного в ней разобраться, то мгновенно убеждаешься в том, что лучшего помощника для любых математических операций не найти! Никакие калькуляторы или специализированные программы для просчетов не смогут переплюнуть Excel, т.к. они узконаправлены, а Эксель охватывает все виды вычислений! Кроме того, любые вычислительные приложения основаны на зависимости значений в ячейках, а круче Excel в этом никто не разбирается! А если установить себе пакет надстроек VBA Excel, то вы сможете выполнять все вычислительные действия быстро и эффективно!
Надстройка VBA-Excel для Microsoft
Excel VBA надстройка позволяет вам максимально расширить функционал программы, не изменяя, а дополняя программу полезными опциями. Благодаря надстройкам VBA Excel вы сможете не только упростить однотипные задачи, и выполнять их намного быстрее, но также максимально упростить рутинную работу. Большое количество дополнительных команд порадует вас своим функционалом, кроме того — на каждую команду можно назначить свою горячую клавишу, что еще более упростит работу в программе Microsoft Excel.
Скачать пакет надстроек VBA Excel на русском
Скачать надстройки Excel VBA вы сможете пакетом с нашего сайте по ссылке в конце статьи. Этот пакет распространяется совершенно бесплатно и устанавливается без труда на любую версию Excel. На сегодняшний день пакет VBA надстроек содержит в себе более 80 функций, а также более 25 макросов! Теперь-то вы точно найдете именно ту надстроечку, которая поможет вам сократить время работы до минимума, максимально подняв эффективность и производительность работы в документах Excel!
Надстройка VBA-Excel на русском
Надстройка VBA-Excel скачать
Надстройка VBA-Excel установить
Libraries add pre-defined code structures (such as functions, subroutines among others) in a simple and easy way.
In the VBA context, a library usually allows access to new objects and functions.
Standard Libraries
Libraries that are enabled by default when opening Excel:
- Excel – This is a collection of classes available in Excel, allowing you to work with worksheets objects E.g. workbooks, spreadsheets, ranges, etc…
- Office – It is a generic class collection for all Office suite applications, allowing you to work with Office objects in general E.g. command bar, help, etc…
- stdole – It is the standard collection of the OLE class, it allows exchange of information between applications
- VBA – It is the class collection that allows functions to be used E.g. MsgBox, InputBox, string functions, etc…
- VBAProject – It is the local collection for the active workbook, (E.g. spreadsheets, users, etc…)
Class: is what defines the structure of a given object (E.g. for class Range we have objects like Range(«A1»), Range(«C2:B5»), and so on).
Enabling Libraries
To access, enable and disable libraries in VBA:
- In Excel, open the VBE (+)
- On the Menu Bar, click Tools
- Select References… (the References – VBAProject dialog box will be displayed)
- Select the desired libraries
- Click OK
To add a library that is not in the list, use the button and select the file of the new library.
Enabling additional libraries allows you to develop codes that communicate with other applications and processes. E.g. Word, Outlook, DAO (Data Access Objects), ADOdb (Active Data Objects database), etc…
When we refer to a library in the code but forget to enable it, the following error message is displayed:
Object Browser
The Object Browser allows you to view the list of all the different objects, methods, and properties of the enabled libraries.
To search the libraries:
- Click on the Object Browser icon on the toolbar ()
- Select the library you want to view on the dropdown menu
- Navigate the library
When in doubt, the Microsoft Help button () can elucidate the utility of the selected element.
VBA Early Binding vs Late Binding
You can use structures from a library without enabling it. This procedure is called Late Binding.
Dim OutApp As Object
Set OutApp = CreateObject("Outlook.Application")
Usually for the Late Binding a variable is declared as an object and later associated with CreateObject.
When we enable a library to access its structures we are performing what is called Early Binding.
Dim OutApp As New Outlook.Application
In the example case the Outlook library was enabled ().
Early & Late Binding Differences
Early: From the point of view of code development and performance time, Early Binding is more suitable because it allows you to use Excel intellisense ( + ) as well as the library object browser.
Late: Regarding compatibility errors, mainly due to the use of different versions of Excel (which changes the version of the libraries), Late Binding is more indicated.
Intellisense: is an aid, mainly to autocomplete the code, with useful information ( + ).
So, to gain practice with the libraries, try to write the code with Early Binding and later change it into Late Binding.
SuperExcelVBA.com is learning website. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. All Rights Reserved.
Excel ® is a registered trademark of the Microsoft Corporation.
© 2023 SuperExcelVBA | ABOUT