Here is the script that will build the cube daily
You can also add script to move the cubes to the correct destination folders for user access
Remenber, in the model you must fill in the user and password required to access the database (in the Signons window)
option explicit
Sub Main ()
Dim objTransApp As Object
Dim objModel As Object
Dim strModelPath As String
Dim strLocation As String
Dim strModelSource As String
Dim strMsgText As String
'*** Set The Error Trapping *****************************************************
On Error GoTo Errhdlr1:
'*** File Names and Path(s) *****************************************************
strLocation = "C:\Models\PY! Definitions\" ' Set the path to the model
strModelSource = "Sales Analysis.pyi" ' Set the model name
strModelPath = strLocation & strModelSource
'*** Open model inside Transformer **********************************************
Set objTransApp = CreateObject("CognosTransformer.Application.cer1"

Set objModel = objTransApp.OpenModel (strModelPath)
'*** Clean model and build cubes ************************************************
With objModel
.CleanHouse 19981231
.CreateMDCFiles
.Close
End With
Errhdlr1:
Select Case Err
Case 75
strMsgText="Path is invalid."
Case 76
strMsgText="Path not found."
Case 70
strMsgText="Permission denied."
Case Else
strMsgText="Error " & Err & ": " & Error$ & "occurred."
End Select
'*** Display a message about the error that was trapped ************************
MsgBox strMsgText
End Sub