Skip to content

Instantly share code, notes, and snippets.

@pudelosha
pudelosha / XMLribbon.bas
Last active September 13, 2019 07:47
VBA - Build XML Add-Ins ribbon
Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call UnloadCustomRibbon
End Sub
Private Sub Workbook_Open()
Call LoadCustomRibbon
@pudelosha
pudelosha / ADODB.cls
Last active April 1, 2022 08:33
VBA - class to import the data from another MS Excel workbook (ADODB method)
Option Explicit
Private strUser As String
Private strProvider As String
Private strPath As String
Private strProperties As String
Private strSQL As String
Private strPassword As String
Private con As ADODB.Connection
Property Let ConnProvider(strCPR As String)
@pudelosha
pudelosha / DAO.cls
Last active January 27, 2017 15:48
DAO - class to query MS Excel internally
Option Explicit
Private db As DAO.Database
Private rst As DAO.Recordset
Private strName As String
Private blnOptions As Boolean
Private blnReadOnly As Boolean
Private strConnect As String
'
' required libraries
' Microsoft Office xx.x Access database engine Objects
@pudelosha
pudelosha / XLS2PPT.cls
Last active January 27, 2017 15:45
VBA - XLS object export procedures to PPT
Option Explicit
Private PPTApp As PowerPoint.Application
Private PPTPreso As PowerPoint.Presentation
Private PPTPresoReport As PowerPoint.Presentation
Private PPTSlide As PowerPoint.Slide
Private objObjectToExport As Object
Private objNewShape As Object
Private strPresoPath As String
Enum ResizeRescale
Resize = 1
@pudelosha
pudelosha / PivotActions.cls
Last active January 27, 2017 15:44
VBA procedures to rebuild, filter and modify pivot tables
Option Explicit
Private pvt As PivotTable
Private blnUpdate As Boolean
Private varPivotTables As Variant
Enum OrientationType
RowField = 1
ColumnField = 2
PageField = 3
DataField = 4
End Enum
@pudelosha
pudelosha / ChartFormatting.cls
Last active January 27, 2017 15:43
Simple Procedures to format charts in MS Excel
Option Explicit
Private objChart As ChartObject
Enum AxisType
Primary = 1
Secondary = 2
End Enum
Enum BorderType
Hairline = 1
Thin = 2
Medium = -4138
@pudelosha
pudelosha / VBA_Outlook.cls
Last active January 27, 2017 15:42
XLS to Outlook
Option Explicit
Private OTapp As Outlook.Application
Private OTemail As Outlook.MailItem
Private strTo As String
Private strSubject As String
Private strAttachmentPath As String
Private strBodyHTML As String
Private Sub Class_Initialize()
On Error Resume Next
@pudelosha
pudelosha / modUtils.bas
Last active May 30, 2017 13:46
My VBA Functions
' ############################ FUNCTION / PROCEDURE LIST ############################
' ###################################################################################
'
' 1. ListNamedRanges
' The function lists all custom named ranges. It is possible to provide optional parameter so that the function checks if validated text string contains this value
' 2. ListPivotTableDataSources
' The procedures lists all pivot tables and their data sources
' 3. NamedRangeHeaders
' This function returns header names for particular named range
' 4. GetFilePath
@pudelosha
pudelosha / addin.bas
Last active January 27, 2017 15:41
VBA old-fashioned Add-In buttons
Option Explicit
Private Const strToolbarName = "SQL_Tool"
Public Sub ShowToolbar()
On Error Resume Next
Application.CommandBars(strToolbarName).Delete
On Error GoTo 0
Application.CommandBars.Add strToolbarName, , , True
@pudelosha
pudelosha / ListView.cls
Last active January 27, 2017 15:40
VBA ListView coding for fun
Option Explicit
Private strLVControlName As String
Private WithEvents lv As ListView
Private frm As UserForm
Private strToOpenOnClick As String
Private enItemClick As OnItemClick
Private frmForm As UserForm
Private Enum OnItemClick