Skip to Content
0
Former Member
Feb 05, 2009 at 11:13 AM

Update period in VBA/VB6

45 Views

Hi

Im trying to update gl determination from Excel and getting the error 'object doesn't support this property or method' using the following code

Dim oCompanyService As SAPbobsCOM.CompanyService

Dim oPeriodCategoryColl As PeriodCategoryParamsCollection

Dim oPerCategory As PeriodCategory

'get company service

Set oCompanyService = oCmp.GetCompanyService

'get period category Collection

Set oPeriodCategoryColl = oCompanyService.GetPeriods()

'get period category

Set oPerCategory = oCompanyService.GetPeriod(oPeriodCategoryColl.Item(0))

'set the Default sales account

oPerCategory.DefaultSaleAccount = 400010

'update period category

oCompanyService.UpdatePeriod (oPerCategory)

Its the last line that gets the error message

The same code without the 'sets' works in vb 2005 but i need to do it from Excel

Any help gratefully received as i'm losing hair by the handfull

Thanks

Andy McKenny