I'm using VB.Net to manipulate a few Excel workbooks. Recently I ran across a computer (a customer's) that will only allow me to open one workbook. An attempt to open the second workbook causes an abort. Again, this program works on many other computers but not on this one. It seems like the problem is related to either a security setting or something within Excel that is preventing the opening of the second workbook.
The second workbook is simply a CSV file that I copy the data and paste it into another file. Below is the code that has worked for years and still works on all but machines but the one in question.
'If CSV file existsIf File.Exists(uvlFile) Then'Open CSV file into a new workbook in the open Excel.oExcel.Workbooks.OpenText(Filename:=uvlFile, _Origin:=Excel.XlPlatform.xlMSDOS, _DataType:=Excel.XlTextParsingType.xlDelimited, _Comma:=True)
I even modified this to the following but still get the same problem.
The open command seems to work and I get the abort when trying to access the "opened" workbook. This is Workbook(2) below. I get an error related to an invalid index. This is a valid error because the second workbook never opens.