ms-office
Using Python to program MS Office macros?
Yes, absolutely. You want to use win32com module, which is part of pywin32 (get it here). I’ve found you can really simplify Python integration by writing a macro in VBA for Python to use, and then just have Python call the macro. It will look something like this: from win32com.client import Dispatch as comDispatch xl … Read more
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
How to avoid spell checking of source code in MS Word?
This one’s easy. Select the code you pasted, go to Tools -> Language (or in the latest version of Word, the equivalent on the ribbon) and select the checkbox “Don’t check.”
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
C#: Getting the number of rows/columns with ExcelPackage
You can get the row and column count using ExcelPackage (EPPlus.dll version 3.0.0.2) as below: var rowCnt = worksheet.Dimension.End.Row; var colCnt = worksheet.Dimension.End.Column;
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