Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro error Wrong Argument Value

Status
Not open for further replies.

amac72

MIS
Jan 16, 2004
12
CH
Dear cognos forum members,

by trying to add a special category using a macro code I get the error message R440 "AutoExe: (Type) : Wrong argument value. Does anyone now more about this error message and what I have to do?

The macro code is an example based on the Great outdoor Company mdl. The error rises in line after 'create a special category commentary.

code:

Sub Main()
Dim objTransApp As Object
Dim objModel As Object
Dim objCat1 As Object
Dim objCat2 As Object
Dim objSpecCategory As Object
Dim strModelPath As String
Dim strLocation As String
Dim strModelSource As String
strLocation = "C:\Program Files\Cognos\Cer2\Samples\PowerPlay"
strModelSource = "\Cubes and Reports\Great Outdoors Company.mdl"
strModelPath = strLocation & strModelSource
Set objTransApp = CreateObject("CognosTransformer.Application")
Set objModel = objTransApp.OpenModel (strModelPath)

'Create a special category in a non-time dimension.
Set objSpecCategory = objModel.Dimensions("Products").Categories.Add(trSpecialCategory)
With objSpecCategory
.Code = "MySpCategoryCode"
.Name = "MySpCategoryName"
.update
End With

'Grab the 2 regular categories that we want under the special category
Set objCat1 = objModel.Dimensions("SourceDimName").DrillDowns(1).Categories(5)
'Print objCat1.Code & " " & objCat1.Label 'Debug Print to check that we got the right category
Set objCat2 = objModel.Dimensions("SourceDimName").DrillDowns(1).Categories(4)
'Print objCat2.Code & " " & objCat2.Label 'Debug Print to check that we got the right category

'Associate 2 regular categories with the new special category
objSpecCategory.ConnectWithCategory objCat1
objSpecCategory.ConnectWithCategory objCat2

objSpecCategory.Update

With objModel
.SaveAs strLocation & _
"\Cubes and Reports\Great Outdoors CompanyX.mdl"
.Close
End With
Set objSpecCategory = Nothing
Set objModel = Nothing
Set objTransApp = Nothing
End Sub



regards,

AmAc
 
I found a solution ..

The solution would be to Copy the TransCont.inc file into the directory that contains the macro and use a '$Include "TranConst.inc" in the beginning of the code before the sub main () part.


Regards,

Amac
 
Cool - or just replace trSpecialCategories with 14, the value shown in the Transcont.inc file.
Still, blame cognos for failing to check their examples!

lex
 
There is nothing to blame on cognos. I deleted the row in my script. My own fault :)
amac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top