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 Problem "CreateObject" fails!!

Status
Not open for further replies.

bobg4u

IS-IT--Management
Jun 3, 2003
46
CA
Hi,
I just started using Cognos Series 7.0,and am updating my reports and macros. The macros are failing because the CreateObject Function is failing. The Code I used is as follows:
Dim ImpApp as Object
Dim ImpRep as Object

Sub Main

Set ImpApp= CreateObject("CognosImpromptu.Application")
cat_dir="N:\shared\catalogs\PayRoll.cat"
rep_dir="N:\shared\Misc Reports\Labor Distribution Hotfile.imr"

ImpApp.OpenCatalog cat_dir,"User"
sPrompt=sBegDate & "|" & sEndDate

Set ImpRep = ImpApp.OpenReport(rep_dir,sPrompt)
ImpRep.RetrieveAll
strHotFile=Left$(ImpRep.FullName, Len(ImpRep.FullName) - 4)

ImpRep.ExportHotFile strHotFile & ".ims"


Set ImpRep=Nothing
Set ImpApp = Nothing

End Sub

--- When I run this i get an error:
R429 "Object creation failed - bad object class"

Can someone tell me what's wrong?

Thanks for the help!
 
Bob,
I had a similar problem following an upgrade - the scheduler couldn't determine which version to use. Does your machine have more than one copy of Impromptu on it?
Try putting ".cerX" after application in the CreateObject statement, where cerX is the subfolder of the Cognos installation (either cer1, cer2 or cer3).
lex
 
Hi lex,
sorry i couldn't respond earlier..but putting a cer2(which is the installation directory of Cognos 7.0), does't help.
Does it have to be like
CreateObject(Impromptu.Application.cer2) ?
I tried this and also putting the .cer2 after Impromptu.But it didn't help.
Another problem is,when I open Impromptu Admin, and from there, I try to get to ScriptEditor (Tools -> Macro), the common dialog box opens up to select the file, but the Run,New,Edit options are all disabled.
Does this seem like an installation problem?

thanks
 
Bob,
Could well be an installation program. Try uninstalling the script editor and impromptu and then re-installation. Might even require an amend on the Registry (assuming you're running cognos on a Windows OS).
lex
 
Lex,
Yes I am running on Windows 2000.
what changes to the Registry do you think will be needed?

thanks
bob
 
Sub Main()
Dim objImpApp as Object
Set objImpApp = CreateObject("Impromptu.Application")
objImpApp.Visible True

*****Sometimes trying different verbage worked...

CP [cook]
 
CP,that did not work.Actually I had to change the macro after updating from vers 6 to 7.
In Imp 6, it was "Impromptu.Application", but the documentation for 7 says the application name is "CognosImpromptu.Application".
but then,it doesn't work on my m/c.

maybe i need a re-install!
 
Bob,
Be *very* careful if you tamper with the Registry. I'd only go down this route if nothing else works. Take a copy first, after un-installation of Impromptu. Remove all references to Impromptu (check also for ImpAdmin). Reboot and then re-install.
Can't stress the importance of care here - you can seriously screw up your PC if you make a mistake.
Lex
 
Try this first?
Uninstall the Cognos Script editor and re-install the Cognos Script editor only. If this still doesn't fix it , then do a full uninstall of Impromptu, then re-install.
That would be my next step.

Were all your .imr's opened and saved in S7 just fine?
Is the catalog working fine in S7 with other imr's?
Are other macro's working at all?



CP [cook]
 
Thanks lex and CP,for the advice.
CP,
I saved(not all but some of) my .imr's to S7.
Also upgraded the catalog to S7.
all other macros too use the CreateObject function,and are not working.

I'll try uninstalling the Script Editor first.
will let you know how it works. will take some time as the Admin has to do this!

bob
 
Hi All,
My problem is resolved.
There definitely was some problem with the registration of the DLL's.But without having to tamper with the registry,or reinstalling the Application,I tried the Configuration Manager Tool. I checked the Verify and Apply Settings Options.I think this actually corrected all the registration problems,and the Macro Script Editor worked fine.It picked up the Impromptu Application Name(both Impromptu.Application and CognosImpromptu.Application worked!) and the ScriptEditor was running from within Impromptu(it enabled the Run,Edit,New options).

So, maybe the Configuration Manager would be a nice way to check for problems with the Registry.

Thanks all for your time

bob
 
bob,
glad you got it solved without a visit to the registry or the time in uninstall & re-install.
lex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top