Skip to Content
Jan 30, 2018 at 10:15 AM

Mapping VB Script: Error -> Object required 0x800A01A8

1400 Views Last edit Jan 30, 2018 at 12:01 PM 4 rev


I need some help to fix the following error.

I have a script to map the entities and attributes with a excel spreadsheet.

The first and second loop works fine and mapped the entities and attributes. I can see them in the "Mapping Editor". But in the third round i get the following error.

Dim TargetM, SourceM, TargetEnt, SourceEnt, TargetAtt, ds ,m1, NSE 
Dim NTE, NSA, NTA, attm

'Open the Excel Sheet with the mapping information
Set objExcel = CreateObject ("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:/...")

'Open the two Models for mapping
set TargetM = OpenModel ("C:\...")
set SoureM = ActiveModel

'Mapping the two Models
Set ds = SourceM.DataSources.CreateNew(cls_DefaultDataSource)
ds.SetNameandCode "Vorsystem_SAP_GP", "Vorsystem"

'Loop to create the mappings between the Entities and Attributes
For j = 2 To 100
	Set NSE = objWorkbook.Sheets(2).Cells(j, 4)
	Set NTE = objWorkbook.Sheets(2).Cells(j, 1)
	Set SourceEnt = SourceM.FindChildByName(NSE, PdLDM.cls_entity)
	Set TargetEnt = TargetM.FindChildByName(NTE, PdLDM.cls_entity)

	Set m1 = ds.createMapping(SourceEnt)

	Set NSA = objWorkbook.Sheets(2).Cells(j, 5)
	Set NTA = objWorkbook.Sheets(2).Cells(j, 2)
	Set SourceEnt = SourceEnt.FindChildByName(NSE, PdLDM.cls_EntityAttribute)
	Set TargetEnt = TargetEnt.FindChildByName(NTE, PdLDM.cls_EntityAttribute)

	Set attm = ds.createMapping(SourceAtt)
	attm.AddSource(TargetAtt) 'Error



Microsoft VBScript runtime error ->Object requierd: 'attm' (0x800A01A8)

any help, advice, corrections or comments are welcomed!