Skip to content

Instantly share code, notes, and snippets.

View bervukas's full-sized avatar

Bernard Vukas bervukas

View GitHub Profile

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:

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:

Option Explicit
Option Private Module
'@TestModule
'@Folder("Tests")
Private Assert As Object
'@ModuleInitialize
Public Sub ModuleInitialize()
'@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
@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 / 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 / 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 / UsingParameters.vb
Last active March 1, 2016 10:20
Example: Using Function and Sub Parameters in VBA
Function CreateProposal(clientName As String,
clientId As Integer,
title As String,
subtitle As String,
projectName As String,
reportDate As Date,
preparedBy As String,
reviewedBy As String,
authoredBy As String,
fontSize As Integer) As Boolean
@bervukas
bervukas / CodingErrorsTest.vb
Created February 28, 2016 12:24
VBA Code Check: How many coding errors can you find?
Function CalculateHourlyRate()
End Sub