The below code returns Run Time Error 97 – Can not call friend on object which is not an instance of defining class.
Option Compare Database
Public Static Sub QBCostCodeTest()
Dim QBC As QBConnection
Dim QBItem As qcItem
Dim strString As String
Set QBC = QBConnection
‘, “\\ramqb01\e$\RAM\EVG testing\Evergreene Companies Test.qbw”
QBC.Connect “”, “MyAppName”, qbOpenModeDontCare, “”, “Q:\RAM\EVG Testing\MyQuickBooksDatabaseName.qbw”
Set QBItem = QBC.Company.Items(100)
Items.Rename QBItem, “1118 Eng – Driveways”
I should have mentioned that:
1. The error occurs on the line: Items.Rename QBItem, “1118 Eng – Driveways”, so Items.Commit will not even run.
2. This exact same code works for renaming Venders and Customers, but errors on Items.