I often have to write up engineering calculations for my work. Often I use LaTeX because of its excellent handling of equations, references, and custom variables. My strategy is to do the calculations in Excel, then create custom variables in a variables.tex file that contain all the values from my spreadsheet that will appear in the write up. I do this because if there is an error in my calculation, I can just change the value in one place and it will be corrected everywhere in the document where it appears. Unfortunately, I sometimes have to deal with 50 or 100 values. Manually changing those even in only one place can quickly become time consuming, so I wrote the following Excel macro to automatically write the variables.tex file for me when I save the spreadsheet. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Const texFileName As String = "variables.tex" Dim FileNum As Integer Dim curLabel As String Dim curValue As String FileN...