title: How to determine file encoding type with Excel VBA
body: <p>I have built an Excel/VBA tool to validate csv files to ensure the data they contain is valid. They csv can come originate from anywhere (from a full blown unix system or a desktop user saving data out from Excel). The Excel tool is sent out to businesses so they can validate their csv files in their own environment and without taking the risk of their data leaving thier systems. Thus, the solution needs to be in native VBA and not link into external libraries.</p>
  
  <p>So using VBA, I need to be able to automatically detect UTF-8 (with or without BOM) or ANSI file encodings and warn the user if these are not the file encodings used for the csv.</p>
  
  <p>I think this would perhaps involve reading in a few bytes from the start of the file and determining the encoding based on the existance of the byte order mark.</p>
  
  <p>Could you help me get me started on the right track?</p>