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!

Help! Save impromptu report as excel with format

Status
Not open for further replies.
Dec 13, 2002
109
GB
Hi

Im trying to save an impromptu report as excel with format from a macro. I am using the script layout suggested on the cognos support site:

Sub Main

Dim objimp As Object
Dim objrep As Object

Set objimp = CreateObject("Impromptu.Application")
objimp.OpenCatalog "C:\Test\aaa.cat"
Set ImpRep = ObjImp.OpenReport("C:\Test\aaa.imr")
objimp.Visible True

AppActivate "Impromptu - [aaa.imr]"
SendKeys "%F",1
SendKeys "A",1
SendKeys "{TAB}",1
SendKeys "{DOWN 8}",1
SendKeys "{ENTER}",1
SendKeys "+{TAB}",1
SendKeys "D:\test.xls",1
SendKeys "{ENTER}",1

Set objrep = Nothing
Set objimp = Nothing

End Sub


The problem lies with the sendkeys. The first sendkey to open the File menu seems to hang and nothing else happens. I can see the impromptu application on screen with the file tab looking like its been depressed but thats it! It just sits there. Interestingly when i run the script from the macro.mac file within cognosscript editor it works. When I run the macro.mcx file it hangs! Same code just one is compiled and the other is not.

Has anyone else experienced this? Is something stealing the focus? (No other active windows open though) or can I insert some delays between the statements?

Any help appreciated.

Ronald
 
Ronald,
The same question was posted some time back, it was a long thread with some 30 replies where experts like Dave Griffin gave good replies with sample codes.

Check with the Search feature..

Prasad.
 
Or, depending on your licence and re-seller, upgrade to Impromptu 7.1 (a.k.a. Series 7 ver. 2) where save with format is scriptable.
lex
 
Hmmm, nothing at all on this forum regarding Impromptu hanging and v7 at this time is not viable...

Ronald
 
ronald,
you say you're running the .mcx file. Does it work if you run the .mac file in scheduler? I've got similar scripts running in 7.0 (only testing 7.1), and the only problem I have experienced is that sendkeys will not work if the PC is locked (the ctrl-alt-del and 'lock' from Task Manager) - the "AppActivate" command is blocked until I take the lock off.
lex
 
If I run the .mac from scheduler it does the same. I notice that the file menu drop down on impromptu does actually happen from the sendkey input but its ultra fast. Weird.

Ronald
 
Ronald
Checking my scripts I have
Set objImpRep = objImpApp.ActiveDocument
just before App.Activate.
Other concern - I use another pair of {TAB} & {ENTER} in order to confirm overwrite of the existing file. Is your macro hanging because test.xls already exists?
lex
 
Hi

I got it to work eventually but have abandoned the idea in light of your comments re: the screen lock. We have this set to come on after 10 minutes and we are not allowed to alter this clientside (where i run the macros).

Going to try saving as csv with options to put text fields in "".

Hope this can be done!

Thanks for your help

Ronald
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top