Skip to Content
Former Member
Jun 29, 2015 at 11:40 PM

Microsoft VBA - "Can't assign to read-only property"



I'm receiving a compile error "Can't assign to read-only property" in an Excel VBA enabled workbook. The code in bold raises the compile time error.

The relevant code is:

Set oOrder = oCompany.GetBusinessObject(SAPbobsCOM.oOrders)


oOrder.Lines.Text = "some sample text"

Note that I can successfully update all fields on header and row level (including UDFs of type text and date) on a sales order and this is the only field that is giving problems. Additionally, this field can be updated via the UI. The field in SQL db is of type 'ntext'.

eg. oOrder.Lines.FreeText = "some sample text" works fine (100 char field, not of type ntext though).

I'm using 9.1 PL07 and SQL Server 2008 R2 SP3. This issue has also been reproduced on 8.82 (not sure of PL).

Is it fair to assume that the read-only property for this field has been incorrectly set in SAPbobsCOM ? Or do I have to use a different syntax for fields of type text?

Thank you.