Skip to content

Instantly share code, notes, and snippets.

View bervukas's full-sized avatar

Bernard Vukas bervukas

View GitHub Profile
@bervukas
bervukas / Validation.vb
Last active February 28, 2016 18:10
Example: Data validation in VBA
Function Test(L1 As Long, L2 As Long, Optional P1 As Variant, Optional P2 As Variant) As String
Dim S As String
If IsMissing(P1) = True Then
S = "P1 Is Missing."
Else
S = "P1 Is Present (P1 = " & CStr(P1) & ")"
End If
@bervukas
bervukas / ExcelVBAUnitTest.vb
Last active May 27, 2019 23:57
Tutorial: Excel Unit Testing with VBA
Option Explicit
''
' Validate the password length so that it's between 8-16 characters long
'
' Returns:
'
' TRUE - Password matches the lenght requirement
' FALSE - Password doesn't match the length requirement
@bervukas
bervukas / EmptyTestMethod.vb
Created May 4, 2016 15:44
Empty Test Method in Rubberduck VBA
'@TestMethod
Public Sub TestMethod1() 'TODO: Rename test
On Error GoTo TestFail
'Arrange:
'Act:
'Assert:
Assert.Inconclusive
@bervukas
bervukas / ExcelCodedUIDemo.cs
Last active December 23, 2016 05:39
Sample snippet used in Coded UI Test for an Excel COM add-in
// Launch Excel 2016 from '%ProgramFiles%\Microsoft Office\root\Office16\EXCEL.EXE'
ApplicationUnderTest excelApp = ApplicationUnderTest.Launch(this.StartAndQuitExcelParams.ExePath, this.StartAndQuitExcelParams.AlternateExePath);
// After Excel loads, click the 'Blank workbook' list item
Mouse.Click(blankWorkbookListItem, new Point(117, 182));
// Select your add-in's ribbon tab
Mouse.Click(myAddinRibbonTab, new Point(276, 771));
// Click a control on your add-in's ribbon, in order to display the VBA userform
'@TestMethod
Public Sub TestMethod1() 'TODO Rename test
On Error GoTo TestFail
'Arrange:
'Act:
'Assert:
Assert.Inconclusive
Option Explicit
Option Private Module
'@TestModule
'@Folder("Tests")
Private Assert As Object
'@ModuleInitialize
Public Sub ModuleInitialize()

Keybase proof

I hereby claim:

  • I am bervukas on github.
  • I am bvukas (https://keybase.io/bvukas) on keybase.
  • I have a public key ASAOi3k7ofi2YVwvQXPTF1GSA6atPVG1_eI_j11K5AJXOwo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am bervukas on github.
  • I am bvukas (https://keybase.io/bvukas) on keybase.
  • I have a public key ASCP4a7mtsGfbozAVML6c0ycUCMThqd4-OF-uH4jhXfstwo

To claim this, I am signing this object: