Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>An alternative way of handling versioning of an XLA file is to use a custom property in Document Properties. You can access and manipulate using COM as described here: <a href="http://support.microsoft.com/?kbid=224351" rel="nofollow noreferrer">http://support.microsoft.com/?kbid=224351</a>.</p> <p>Advantages of this are:</p> <ul> <li><p>You can examine the version number without opening the XLA file</p></li> <li><p>You don't need Excel on your build machine - only the DsoFile.dll component</p></li> </ul> <p>Another alternative would be to store the version number (possibly other configuration data too) on a worksheet in the XLA file. The worksheet would not be visible to users of the XLA. One technique I have used in the past is to store the add-in as an XLS file in source control, then as part of the build process (e.g. in a Post-Build event) run the script below to convert it to an XLA in the output directory. This script could be easily extended to update a version number in a worksheet before saving. In my case I did this because my Excel Add-in used VSTO, and Visual Studio doesn't support XLA files directly.</p> <pre><code>' ' ConvertToXla.vbs ' ' VBScript to convert an Excel spreadsheet (.xls) into an Excel Add-In (.xla) ' ' The script takes two arguments: ' ' - the name of the input XLS file. ' ' - the name of the output XLA file. ' Option Explicit Dim nResult On Error Resume Next nResult = DoAction If Err.Number &lt;&gt; 0 Then Wscript.Echo Err.Description Wscript.Quit 1 End If Wscript.Quit nResult Private Function DoAction() Dim sInputFile, sOutputFile Dim argNum, argCount: argCount = Wscript.Arguments.Count If argCount &lt; 2 Then Err.Raise 1, "ConvertToXla.vbs", "Missing argument" End If sInputFile = WScript.Arguments(0) sOutputFile = WScript.Arguments(1) Dim xlApplication Set xlApplication = WScript.CreateObject("Excel.Application") On Error Resume Next ConvertFileToXla xlApplication, sInputFile, sOutputFile If Err.Number &lt;&gt; 0 Then Dim nErrNumber Dim sErrSource Dim sErrDescription nErrNumber = Err.Number sErrSource = Err.Source sErrDescription = Err.Description xlApplication.Quit Err.Raise nErrNumber, sErrSource, sErrDescription Else xlApplication.Quit End If End Function Public Sub ConvertFileToXla(xlApplication, sInputFile, sOutputFile) Dim xlAddIn xlAddIn = 18 ' XlFileFormat.xlAddIn Dim w Set w = xlApplication.Workbooks.Open(sInputFile,,,,,,,,,True) w.IsAddIn = True w.SaveAs sOutputFile, xlAddIn w.Close False End Sub </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload