Using Excel with Databases and Data Files
Posted on February 20, 2019Download this demonstration of many useful techniques for using Microsoft Excel, VBA, and ADO with the Access Database Engine to work with CSV (comma-separated values) files, Access databases, and SQL Server databases.
- Use ADO to make connections to CSV files, Access databases, and SQL Server databases in VBA.
- Perform an SQL Join operation on multiple related CSV files.
- Use parameters to build dynamic SQL queries in VBA.
- Use records in a recordset to build a collection of objects in VBA.
- Use hierarchical collections of objects in VBA to build a hierarchical Excel worksheet with collapsable rows and columns.
- Create an Access database from multiple related CSV files.
- Many other useful techniques …
Yahtzee in Excel
Posted on February 20, 2019Download this free Yahtzee game written entirely in Microsoft Excel.
It uses the little-known Excel Camera tool to show pictures of random dice.
Great waste of time.
Excel Default Formulas
Posted on February 20, 2019Developed as a Microsoft Excel add-in, Default Formulas gives the developer the control of protected mode without the limitations.
Establish default formulas for a range.
- Works great with Tables (ListObjects).
- Automatically uses structured references if available.
Operator can override default formulas.
- Default formulas and overriden formulas are designated to the operator by color.
- Makes changes to formulas obvious.
- Operator can return cells to their default formulas by simply pressing [Delete].
Use Defaulted and NotDefaulted functions to return ranges of cells for use in calculations.
- NotDefaulted function makes it simple for default formulas to refer to themselves without encountering circular reference errors.
Create default formulas with circular references.
- As long as any one of cells in the circular relationship are not defaulted, no errors will result.
- Very compact method for allowing operator to choose from multiple input methods.
- Examples:
- Establish default formulas for Start, Duration, and Finish. Operator can override their choice of any two and the remaining default formula computes the missing value.
- Establish default formulas for Qty, Unit Price, and Total Price. Operator can override their choice of any two and the remaining default formula computes the missing value.
- Establish default formulas for Fahrenheit and Celsius. Operator can override their choice and the remaining default formula computes the corresponding value.
Hotkey reveals DefaultFormulas user interface
Default Formulas are stored in hidden named ranges, which can be revealed and edited manually if desired.
Passing Decimal Parameters to SQL Server
Posted on April 09, 2017' Execute stored procedure to add record.
Set cmd = ADOCommand("InsertLogWaypoint", cn, adCmdStoredProc)
With cmd
.Parameters.Append .CreateParameter("Time", adDBTimeStamp, adParamInput, , rstLog.Fields("Time").Value)
.Parameters.Append .CreateParameter("Lat", adSingle, adParamInput, , rstLog.Fields("Latitude").Value)
.Parameters.Append .CreateParameter("Long", adSingle, adParamInput, , rstLog.Fields("Longitude").Value)
.Parameters.Append .CreateParameter("Acc", adInteger, adParamInput, , rstLog.Fields("Accuracy").Value)
.Parameters.Append .CreateParameter("Dir", adInteger, adParamInput, , rstLog.Fields("Direction").Value)
.Parameters.Append .CreateParameter("Speed", adNumeric, adParamInput, , rstLog.Fields("Speed").Value)
With .Parameters("Speed")
.Precision = 18
.NumericScale = 9
End With
.Parameters.Append .CreateParameter("LocID", adInteger, adParamInput, , rstLog.Fields("LocationID").Value)
.Parameters.Append .CreateParameter("ID", adInteger, adParamOutput)
.Execute
End With

