I only saw that error under when certain conditions were met while the file was open, like if the file is open and I use the line of code to open that file, or similar. Certain ways I format the code doesn't cause that error to pop-up for me. I know the file, sheet, nor the cells are write protected because I can still write to them manually, and I can still write to them using the traditional methods in vb.net (without iLogic's GoExcel Interface).
I prepared an example of two different iLogic rules that are designed to do the same exact simple task of writing column titles to the first 3 cells along the top left of the sheet. One uses iLogic's GoExcel Interface, and the tools it has available. The other example uses the traditional vb.net route of adding a reference to the Excel object library, then using Excel's own objects & methods to interact with it. Both versions are using the same exact Excel file, same sheet, and same cells, and trying to write the same data to those cells. The worksheet is visibly open while running both versions. The GoExcel version doesn't write the data, but the other version does write the data. This tells me there must be something else going on. I have the Excel Engine in the iLogic Configuration settings set to 'COM', as it should be, because I have Excel installed and generally prefer to use it rather than the 'internal' tool.
Example 1 (GoExcel)
oXLFile = "C:\Temp\Test1.xlsx"
oSheet = "Sheet1"
GoExcel.Open(oXLFile, oSheet)
GoExcel.DisplayAlerts = True
GoExcel.CellValue("A1") = "Column 1"
GoExcel.CellValue("B1") = "Column 2"
GoExcel.CellValue("C1") = "Column 3"
'GoExcel.CellValue(oXLFile, oSheet, "A1") = "Column 1"
'GoExcel.CellValue(oXLFile, oSheet, "B1") = "Column 2"
'GoExcel.CellValue(oXLFile, oSheet, "C1") = "Column 3"
'GoExcel.Save
'GoExcel.Close
Example 2 (Excel Object Library + vb.net)
AddReference "Microsoft.Office.Interop.Excel.dll"
Imports Microsoft.Office.Interop.Excel
Sub Main
oXLFile = "C:\Temp\Test1.xlsx"
oSheet = "Sheet1"
If Not System.IO.File.Exists(oXLFile) Then Exit Sub
Dim oExcel As Microsoft.Office.Interop.Excel.Application
oExcel = GetExcel
If IsNothing(oExcel) Then Exit Sub
oExcel.DisplayAlerts = False
oExcel.Visible = True
'Get/Open the Workbook (file) to work with
Dim oWB As Workbook = oExcel.Workbooks.Open(oXLFile)
'Dim oWB As Workbook = oExcel.Workbooks.Add()
'Get the Worksheet (sheet) to work with
Dim oWS As Worksheet = oWB.Worksheets.Item("Sheet1")
'Dim oWS As Worksheet = oWB.Worksheets.Add
'Write Values To Cells by their Cell Address
oWS.Range("A1").Value = "Column 1"
oWS.Range("B1").Value = "Column 2"
oWS.Range("C1").Value = "Column 3"
oWS.Columns.AutoFit
'oWB.Save
'oWB.Close
'oExcel.Quit
End Sub
Function GetExcel() As Microsoft.Office.Interop.Excel.Application
Dim oXL As Microsoft.Office.Interop.Excel.Application
Try
'try to find an already running instance of the Excel Application
oXL = GetObject(, "Excel.Application")
Catch
'it wasn't found open, so create an instance of it (start the application)
oXL = CreateObject("Excel.Application")
'oXL = New Microsoft.Office.Interop.Excel.Application
Catch
MsgBox("Failed to Get/Create an instance of the Excel Application. Exiting.", , "")
Exit Function
End Try
Return oXL
End Function
Wesley Crihfield

(Not an Autodesk Employee)