title: Excel Intermittently Crashes When Opening Network File / Enabling Content With User Defined Functions
body: <p>I have a file stored on our network that houses part number requests.  This file is shared between two departments that, according to IT, are all up to date on 64-bit versions of Excel. </p>
  
  <p>The file houses several simple user defined functions, such as ConcatUniq. 
  The file will open and function properly for weeks at a time, and then randomly will either crash upon opening, or crash upon enabling content.  <strong>We then rebuild the file from scratch, it will work for several weeks, then will crash again.</strong>   These are widely used functions, and we don’t believe the functions themselves are causing the issues. </p>
  
  <p>Additionally, a colleague had issues with the ConcatUniq function returning correct values on some lines, but returining #value errors on other lines. For this, I created a separate sheet with the ConcatUniq UDF, and a loop that sets cell formulas as the ConcatUniq function and allows the UDF to be stepped through, while printing each value in the range. </p>
  
  <p>After saving and then sending this to a colleague to test, it crashed Excel upon opening.  Mine still opened fine, but crashed on enabling content.  This appears to be the bigger issue here, but nonetheless, sometimes the file crashes, sometimes it doesn’t, sometimes the UDF works, and sometimes it doesn’t. </p>
  
  <p>We are unsure as to if this is a problem with Excel / Add-ons, our network/firewall paramaters, or the VBA itself.  I don’t believe this is any sort of compiler error, as the functions do work locally.  This problem seems to happen after these files are saved by users on the network.</p>
  
  <p>I am hoping for some guidance regarding where to look for an issue causing these symptoms (Excel, network/firewall, VBA).  Any help is greatly appreciated!</p>
  
  <p>As requested: </p>
  
  <pre><code>    Function ConcatUniq(ByRef rng As Range, _
      ByVal myJoin As String) As String
  Dim r As Range
  Static dic As Object
  If dic Is Nothing Then _
  Set dic = CreateObject("Scripting.Dictionary")
  For Each r In rng
      dic(r.Value) = Empty
  Next
  ConcatUniq = Join$(dic.keys, myJoin)
  dic.RemoveAll
  End Function
  
  'syntax = concatuniq(RANGE,"delimeter")
  </code></pre>