VBA: How to display an error message just like the standard error message which has a “Debug” button?

First the good news. This code does what you want (please note the “line numbers”) Sub a() 10: On Error GoTo ErrorHandler 20: DivisionByZero = 1 / 0 30: Exit Sub ErrorHandler: 41: If Err.Number <> 0 Then 42: Msg = “Error # ” & Str(Err.Number) & ” was generated by ” _ & Err.Source … Read more

Get started with Office 365 REST API

[Update Aug 20th, 2015]: It looks like there is a new getting started experience, which will help register your app, and even create a starter project in the language of your choice. I would certainly recommend trying that first, rather than going through the manual steps outlined below. To register apps manually (e.g., not through … Read more

How do you comment an MS-access Query?

I decided to add a condition to the Where Clause that always evaluates true but allows the coder to find your comment. Select … From … Where …. And “Comment: FYI, Access doesn’t support normal comments!”<>”” The last line always evaluates to true so it doesn’t affect the data returned but allows you to leave … Read more

Hiding an Excel worksheet with VBA

To hide from the UI, use Format > Sheet > Hide To hide programatically, use the Visible property of the Worksheet object. If you do it programatically, you can set the sheet as “very hidden”, which means it cannot be unhidden through the UI. ActiveWorkbook.Sheets(“Name”).Visible = xlSheetVeryHidden ‘ or xlSheetHidden or xlSheetVisible You can also … Read more

How to get a list of installed OLE DB providers?

If you have powershell available, just paste this into a powershell command prompt: foreach ($provider in [System.Data.OleDb.OleDbEnumerator]::GetRootEnumerator()) { $v = New-Object PSObject for ($i = 0; $i -lt $provider.FieldCount; $i++) { Add-Member -in $v NoteProperty $provider.GetName($i) $provider.GetValue($i) } $v } Credits and more advanced usage: http://dbadailystuff.com/list-all-ole-db-providers-in-powershell